As to your point 1: > Since this is specific to postgres
Well, Window expressions aren't specific to Postgres: - They exist in Oracle - They exist in MariaDB 10.2 which is in beta and will be GA at around the same time this patch is out: https://mariadb.com/kb/en/mariadb/window-functions/ I thus think this should all be part of Django's main QuerySet API. On Tuesday, November 29, 2016 at 8:56:47 PM UTC, Mads Jensen wrote: > > On Saturday, November 26, 2016 at 1:51:05 AM UTC+1, Josh Smeaton wrote: >> >> OrderBy takes an expression - it doesn't have to be a single column. For >> example, this is valid: >> >> (Lower('last_name') + Lower('first_name)).desc() == >> OrderBy(Lower('last_name') + Lower('first_name), descending=True) >> > > Yes. However, I was more interested in being able to add a list of > expressions. The OrderBy-class does not evaluate more than > one expression. The Case-expression right above iterates over all of the > cases, and parses them. This is what I had in mind. I don't writing > something for it, but > I'm trying to use as much of the existing API as possible. > > What I had in mind was offering the flexibility to write this (maybe > offering a list of OrderBy-clauses as valid input would be a way to > remediate this): > > I read over the Query-class code which has add_ordering. > > qs = WindowTestModel.objects.annotate(sum=Window( > expression=Sum('salary'), > order_by=[ExtractYear('hiredate'), F('department')]) > ) > print(qs.query) > > Kind regards, > > Mads > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/da1309ef-dadd-41ab-8332-6a93cdc66719%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.