def as_sql(self, qn, connection):
        field_name = '.'.join(qn(c) for c in self.col)
        if self.normalization:
            normalization_params = ', ' + '|'.join(
                '%d' % i for i in self.normalization)
        else:
            normalization_params = ''

        if self.weights:
            weights_params = "'{" + ', '.join(
                '%.1f' % i for i in self.weights) + "}', "
        else:
            weights_params = ''

        substitutions = {
            'field_name': '.'.join(qn(c) for c in self.col),
            'function': self.sql_function,
            'place': '%s',
            'normalization': normalization_params,
            'weights': weights_params
        }
        substitutions.update(self.extra)
        return self.sql_template % substitutions, [self.params]
dataset/ETHPy150Open dvdmgl/django-pg-fts/pg_fts/ranks.py/AggregateRegister.as_sql/original