You can use group_by clauses with the following queries:

It is used in combination with the aggregate functions - for example, Count.


In the following query, we get a count of the number of bands per manager:

>>> from import Count

>>> await
...     Count(alias='band_count')
... ).group_by(
...     Band.manager
... )

    {"manager_name": "Graydon", "band_count": 1},
    {"manager_name": "Guido", "band_count": 1}

Other aggregate functions

These work the same as Count. See aggregate functions.