MCPcopy
hub / github.com/django/django / pre_sql_setup

Method pre_sql_setup

django/db/models/sql/compiler.py:82–96  ·  view source on GitHub ↗

Do any necessary class setup immediately prior to producing SQL. This is for things that can't necessarily be done in __init__ because we might not have all the pieces in place at that time.

(self, with_col_aliases=False)

Source from the content-addressed store, hash-verified

80 self.col_count = len(self.select)
81
82 def pre_sql_setup(self, with_col_aliases=False):
83 """
84 Do any necessary class setup immediately prior to producing SQL. This
85 is for things that can't necessarily be done in __init__ because we
86 might not have all the pieces in place at that time.
87 """
88 self.setup_query(with_col_aliases=with_col_aliases)
89 order_by = self.get_order_by()
90 self.where, self.having, self.qualify = self.query.where.split_having_qualify(
91 must_group_by=self.query.group_by is not None
92 )
93 extra_select = self.get_extra_select(order_by, self.select)
94 self.has_extra_select = bool(extra_select)
95 group_by = self.get_group_by(self.select + extra_select, order_by)
96 return extra_select, order_by, group_by
97
98 def get_group_by(self, select, order_by):
99 """

Calls 5

setup_queryMethod · 0.95
get_order_byMethod · 0.95
get_extra_selectMethod · 0.95
get_group_byMethod · 0.95
split_having_qualifyMethod · 0.80