MCPcopy
hub / github.com/django/django / Query

Class Query

django/db/models/sql/query.py:231–2791  ·  view source on GitHub ↗

A single SQL query.

Source from the content-addressed store, hash-verified

229
230
231class Query(BaseExpression):
232 """A single SQL query."""
233
234 alias_prefix = "T"
235 empty_result_set_value = None
236 subq_aliases = frozenset([alias_prefix])
237
238 compiler = "SQLCompiler"
239
240 base_table_class = BaseTable
241 join_class = Join
242
243 default_cols = True
244 default_ordering = True
245 standard_ordering = True
246
247 filter_is_sticky = False
248 subquery = False
249 contains_subquery = False
250
251 # SQL-related attributes.
252 # Select and related select clauses are expressions to use in the SELECT
253 # clause of the query. The select is used for cases where we want to set up
254 # the select clause to contain other than default fields (values(),
255 # subqueries...). Note that annotations go to annotations dictionary.
256 select = ()
257 # The group_by attribute can have one of the following forms:
258 # - None: no group by at all in the query
259 # - A tuple of expressions: group by (at least) those expressions.
260 # String refs are also allowed for now.
261 # - True: group by all select fields of the model
262 # See compiler.get_group_by() for details.
263 group_by = None
264 order_by = ()
265 low_mark = 0 # Used for offset/limit.
266 high_mark = None # Used for offset/limit.
267 distinct = False
268 distinct_fields = ()
269 select_for_update = False
270 select_for_update_nowait = False
271 select_for_update_skip_locked = False
272 select_for_update_of = ()
273 select_for_no_key_update = False
274 select_related = False
275 # Arbitrary limit for select_related to prevents infinite recursion.
276 max_depth = 5
277 # Holds the selects defined by a call to values() or values_list()
278 # excluding annotation_select and extra_select.
279 values_select = ()
280 selected = None
281
282 # SQL annotation-related attributes.
283 annotation_select_mask = None
284 _annotation_select_cache = None
285
286 # Set combination attributes.
287 combinator = None
288 combinator_all = False

Callers 15

constraint_sqlMethod · 0.90
db_default_sqlMethod · 0.90
_create_index_sqlMethod · 0.90
_create_unique_sqlMethod · 0.90
checkMethod · 0.90
_get_condition_sqlMethod · 0.90
create_sqlMethod · 0.90
_get_check_sqlMethod · 0.90
_get_condition_sqlMethod · 0.90
as_sqlMethod · 0.90
contribute_to_classMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_simple_queryMethod · 0.72
test_complex_queryMethod · 0.72
test_multiple_fieldsMethod · 0.72
test_transformMethod · 0.72
test_negated_nullableMethod · 0.72
test_foreign_keyMethod · 0.72
test_foreign_key_fMethod · 0.72