MCPcopy Index your code
hub / github.com/django/django / as_sql

Method as_sql

tests/aggregation/tests.py:1337–1347  ·  view source on GitHub ↗
(self, compiler, connection, **extra_context)

Source from the content-addressed store, hash-verified

1335 arity = None
1336
1337 def as_sql(self, compiler, connection, **extra_context):
1338 copy = self.copy()
1339 # Most database backends do not support compiling multiple
1340 # arguments on the Max aggregate, and that isn't what is being
1341 # tested here anyway. To avoid errors, the extra argument is
1342 # just dropped.
1343 copy.set_source_expressions(
1344 copy.get_source_expressions()[0:1] + [None, None]
1345 )
1346
1347 return super(MultiArgAgg, copy).as_sql(compiler, connection)
1348
1349 with self.assertRaisesMessage(TypeError, "Complex aggregates require an alias"):
1350 Book.objects.aggregate(MultiArgAgg("pages", "price"))

Callers

nothing calls this directly

Calls 4

copyMethod · 0.45
as_sqlMethod · 0.45

Tested by

no test coverage detected