'Returns a list of strings that are joined together to go after the
"FROM" part of the query, as well as a list any extra parameters that
need to be included. Sub-classes, can override this to create a
from-clause via a "select".
This should only be called after any SQL construction methods that
might change the tables we need. This means the select columns and
ordering must be done first.'

def get_from_clause(self):

    result = []
    qn = self.quote_name_unless_alias
    qn2 = self.connection.ops.quote_name
    first = True
    for alias in self.query.tables:
        if (not self.query.alias_refcount[alias]):
            continue
        try:
            (name, alias, join_type, lhs, lhs_col, col, nullable) = self.query.alias_map[alias]
        except KeyError:
            continue
        alias_str = (((alias != name) and ('    %s' % alias)) or '')
        if (join_type and (not first)):
            result.append(('%s    %s%s    ON    (%s.%s    =    %s.%s)' % (join_type, qn(name), alias_str, qn(lhs), qn2(lhs_col), qn(alias), qn2(col))))
        else:
            connector = (((not first) and ',    ') or '')
            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 = (((not first) and ',    ') or '')
            result.append(('%s%s' % (connector, qn(alias))))
            first = False
    return (result, [])
