On Fri, Sep 16, 2011 at 8:05 PM, dave bl <db.pub.m...@gmail.com> wrote:
> When is the django orm going to get a "group by" function ? (this is
> srs buz ... Y NO HAZ?). I see that there have been various
> changes(getting closer! - with aggregates and annotate) ... and
> attempts in the past. Is there a "solid" reason for not supporting
> "group by" in the ORM ... (yet) ?

Yes, there is.

Asking for a GROUP BY function in Django's ORM misses the point
entirely of why an ORM exists. Django's ORM isn't SQL. Django's ORM
provides an abstraction layer that is able to make an arbitrary data
store appear like a collection of related objects. There's no
requirement that the data store be a relational database. Therefore,
adding GROUP BY -- a very RDBMS specific construction -- to Django's
ORM makes no sense.

If you want to write SQL, write SQL. Django's object model provides
the raw() call for exactly this reason.

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to