

def get_from_clause(self):
    '\n        Returns a list of strings that are joined together to go after the\n        "FROM" part of the query, as well as a list any extra parameters that\n        need to be included. Sub-classes, can override this to create a\n        from-clause via a "select".\n\n        This should only be called after any SQL construction methods that\n        might change the tables we need. This means the select columns,\n        ordering and distinct must be done first.\n        '
    result = []
    qn = self.quote_name_unless_alias
    qn2 = self.connection.ops.quote_name
    first = True
    from_params = []
    for alias in self.query.tables:
        if (not self.query.alias_refcount[alias]):
            continue
        try:
            (name, alias, join_type, lhs, join_cols, _, join_field) = self.query.alias_map[alias]
        except KeyError:
            continue
        alias_str = ('' if (alias == name) else (' %s' % alias))
        if (join_type and (not first)):
            extra_cond = join_field.get_extra_restriction(self.query.where_class, alias, lhs)
            if extra_cond:
                (extra_sql, extra_params) = extra_cond.as_sql(qn, self.connection)
                extra_sql = ('AND (%s)' % extra_sql)
                from_params.extend(extra_params)
            else:
                extra_sql = ''
            t.append(('%s %s%s ON (' % (join_type, qn(name), alias_str)))
            for (index, (lhs_col, rhs_col)) in enumerate(join_cols):
                if (index != 0):
                    result.append(' AND ')
                result.append(('%s.%s = %s.%s' % (qn(lhs), qn2(lhs_col), qn(alias), qn2(rhs_col))))
            result.append(('%s)' % extra_sql))
        else:
            connector = ('' if first else ', ')
            result.append(('%s%s%s' % (connector, qn(name), alias_str)))
        first = False
    for t in self.query.extra_tables:
        (alias, unused) = self.query.table_alias(t)
        if ((alias not in self.query.alias_map) or (self.query.alias_refcount[alias] == 1)):
            connector = ('' if first else ', ')
            result.append(('%s%s' % (connector, qn(alias))))
            first = False
    return (result, from_params)

dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/sql/compiler.py SQLCompiler.get_from_clause/VarMisuse@203/446 `result`->`t`