class grouping_sets(GenericFunction):
Implement the GROUPING SETS grouping operation.
This function is used as part of the GROUP BY of a statement,
e.g. _expression.Select.group_by
:
stmt = select( func.sum(table.c.value), table.c.col_1, table.c.col_2 ).group_by(func.grouping_sets(table.c.col_1, table.c.col_2))
In order to group by multiple sets, use the .tuple_
construct:
from sqlalchemy import tuple_ stmt = select( func.sum(table.c.value), table.c.col_1, table.c.col_2, table.c.col_3 ).group_by( func.grouping_sets( tuple_(table.c.col_1, table.c.col_2), tuple_(table.c.value, table.c.col_3), ) )
Class Variable | _has_args |
Undocumented |
Class Variable | inherit_cache |
Undocumented |
Inherited from GenericFunction
:
Method | __init__ |
Undocumented |
Class Variable | _register |
Undocumented |
Class Variable | coerce_arguments |
Undocumented |
Instance Variable | _bind |
Undocumented |
Instance Variable | clause_expr |
Undocumented |
Instance Variable | packagenames |
Undocumented |
Instance Variable | type |
Undocumented |