Group by, grouping sets, rollup & cube

Hi folks (in particular Adam, Simon & Mariusz)

There’s a ticket & (closed) PR for adding support for GROUPING SETS, ROLLUP & CUBE by adding a method group_by() to querysets.

Is this something we can progress?

I needed rollup last week and found it non trivial to implement a workaround without falling back to SQL. (I ended up with an expression that forces group_by to use a rollup + value/order by expressions that don’t contribute back into the group_by attribute).

I’ve seen various comments in the code & on the old ML about eventually adding a proper group_by() method - is this something we want? Are there any Or can we just add grouping set support with a smaller api change like adding it to extra() or something?

Adam did you have any comments about that PR? Mariusz/Simon you 2 may be the best to comment on the current state-of-the-art wrt to how group by is automatically determined from values/order_by and whether a group_by() would play nicely with that - do you have any opinions?

1 Like