Support for GROUP BY CUBE, SET, ROLLUP

Issue #3429 resolved
Stefan Urbanek created an issue

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)

  1. Mike Bayer repo owner

    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.

  2. Mike Bayer repo owner

    as always, this is open source, contributing is the best way to make something happen

  3. Log in to comment