

def as_subquery_condition(self, alias, columns, qn):
    qn2 = self.connection.ops.quote_name
    if (len(columns) == 1):
        (sql, params) = self.as_sql()
        return (('%s.%s IN (%s)' % (qn(self), qn2(columns[0]), sql)), params)
    for (index, select_col) in enumerate(self.query.select):
        lhs = ('%s.%s' % (qn(select_col.col[0]), qn2(select_col.col[1])))
        rhs = ('%s.%s' % (qn(alias), qn2(columns[index])))
        self.query.where.add(QueryWrapper(('%s = %s' % (lhs, rhs)), []), 'AND')
    (sql, params) = self.as_sql()
    return (('EXISTS (%s)' % sql), params)

dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/sql/compiler.py SQLCompiler.as_subquery_condition/VarMisuse@58/78 `alias`->`self`