Hi, On Tuesday 04 August 2015 03:28:03 Josh Smeaton wrote: > On Tuesday, 4 August 2015 07:10:05 UTC+10, Shai Berger wrote: > > On Monday 03 August 2015 10:27:14 Anssi Kääriäinen wrote: > > > You can annotate raw SQL with expressions. I think the only case that > > > can't be done with expressions is addition of extra tables to the query. > > > > Also grouping over non-relations, if I am not mistaken. > > > Can you explain/give an example of grouping over non relations? I'll see if > I can translate that to expressions in their current form. > The classic database aggregation examples involve aggregation over time: Sum of sales per quarter (which is, itself, a function over date); average temparature per month; etc. All these require group-by clauses which name (expressions over) columns which are not FKs.
There are many similar examples involving "enum columns" -- columns with a limited set of choices, where the choices are not instances of another model. As far as I am aware, we can still not do these aggregates in the ORM, Shai.