#26696: QuerySet.extra: group by weekday on a date field
-------------------------------------+-------------------------------------
Reporter: karolyi | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 1.9
(models, ORM) | Keywords: QuerySet.extra day of
Severity: Normal | week weekday
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Hey,
I'm coming from the
[https://docs.djangoproject.com/en/1.9/ref/models/querysets/#extra Django
doc], where you say that I should try to avoid using `QuerySet.extra` in
the future, and report the thing I want to achieve here, so you could
improve the ORM. Here's the thing:
I have a mysql table where there is a `date` field. I'd like to do a
`DAYOFWEEK(date)` calculation on it, then `GROUP BY` its result, and then
do some `MIN`/`MAX`/`AVG` calculation on another field in the table. The
point is to get the minimum/maximum/average values for the days of the
week.
Currently this seems impossible with even using the extra parameter.
Or is it?
Tips welcomed, but I actually given up on creating this query out of the
ORM.
--
Ticket URL: <https://code.djangoproject.com/ticket/26696>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.f8acf5c3ccb67ae4cd367c3b8a1ca213%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.