MCPcopy
hub / github.com/ormar-orm/ormar / aggregations

Function aggregations

examples/script_from_readme.py:322–342  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320
321
322async def aggregations():
323 # count:
324 assert 2 == await Author.objects.count()
325
326 # exists
327 assert await Book.objects.filter(title="The Hobbit").exists()
328
329 # maximum
330 assert 1990 == await Book.objects.max(columns=["year"])
331
332 # minimum
333 assert 1937 == await Book.objects.min(columns=["year"])
334
335 # average
336 assert 1964.75 == await Book.objects.avg(columns=["year"])
337
338 # sum
339 assert 7859 == await Book.objects.sum(columns=["year"])
340
341 # to read more about aggregated functions
342 # visit: https://collerek.github.io/ormar/queries/aggregations/
343
344
345async def raw_data():

Callers

nothing calls this directly

Calls 7

countMethod · 0.45
existsMethod · 0.45
filterMethod · 0.45
maxMethod · 0.45
minMethod · 0.45
avgMethod · 0.45
sumMethod · 0.45

Tested by

no test coverage detected