Support for GROUP BY CUBE, SET, ROLLUP
Postgres 9.5 is coming with a new GROUP BY summarizing features. Other dialect providing this feature is, for example, Oracle.
It is quite useful feature in data warehouse environment.
The SQLAlchemy might either provide group_by_*()
function for each of the group by types or have an additional argument in the group_by()
function. The signature might look like: group_by(*clauses, grouping=None)
where grouping might be None
, "cube"
, "rollup"
or "sets"
.
Comments (6)
-
repo owner -
repo owner -
repo owner - changed milestone to 1.x.xx
-
Hey there, wanted to check on this. Would be a really useful update.
-
repo owner as always, this is open source, contributing is the best way to make something happen
-
repo owner - changed status to resolved
Implement placeholders for CUBE, ROLLUP, GROUPING SETS
Fixes:
#3429Co-authored-by: Mike Bayer mike_mp@zzzcomputing.com Change-Id: I870ee7dc801d553c5309c291402ec468b671e9a9 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/383
→ <<cset 509d19e6fd38>>
- Log in to comment
These are individual SQL keywords so they should be standalone elements such as sqlalchemy.cube(), sqlalchemy.grouping_sets(). These are very easy to add and can be in the "sqlalchemy" namespace to the degree that they are part of the SQL standard. These are also very simple to use right now as custom @compiles extensions, and at the moment you could probably get away with just using
func.cube(x, y, z)
even, there doesn't seem to be anything special here syntactically.