'Return three values:
- a list of 3-tuples of (expression, (sql, params), alias)
- a klass_info structure,
- a dictionary of annotations
The (sql, params) is what the expression will produce, and alias is the
"AS alias" for the column (possibly None).
The klass_info structure contains the following information:
- Which model to instantiate
- Which columns for that model are present in the query (by
position of the select clause).
- related_klass_infos: [f, klass_info] to descent into
The annotations is a dictionary of {\'attname\': column position} values.'

def get_select(self):

    select = []
    klass_info = None
    annotations = {}
    select_idx = 0
    for (alias, (sql, params)) in self.query.extra_select.items():
        annotations[alias] = select_idx
        select.append((RawSQL(sql, params), alias))
        select_idx += 1
    assert (not (self.query.select and self.query.default_cols))
    if self.query.default_cols:
        select_list = []
        for c in self.get_default_columns():
            select_list.append(select_idx)
            select.append((c, None))
            select_idx += 1
        klass_info = {'model': self.query.model, 'select_fields': select_list}
    for col in self.query.select:
        select.append((col, None))
        select_idx += 1
    for (alias, annotation) in self.query.annotation_select.items():
        annotations[alias] = select_idx
        select.append((annotation, alias))
        select_idx += 1
    if self.query.select_related:
        related_klass_infos = self.get_related_selections(select)
        klass_info['related_klass_infos'] = related_klass_infos
        def get_select_from_parent(klass_info):
            for ki in klass_info['related_klass_infos']:
                if ki['from_parent']:
                    ki['select_fields'] = (klass_info['select_fields'] + ki['select_fields'])
                get_select_from_parent(ki)
        get_select_from_parent(klass_info)
    ret = []
    for (col, alias) in select:
        try:
            (sql, params) = self.compile(col, select_format=True)
        except EmptyResultSet:
            (sql, params) = ('0', ())
        ret.append((col, (sql, params), alias))
    return (ret, klass_info, annotations)
