#35146: Add support for annotate after union
-------------------------------------+-------------------------------------
     Reporter:  Alexandru Chirila    |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Database layer       |                  Version:
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  duplicate
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * resolution:   => duplicate

Comment:

 I think this request is more of a duplicate of #24462.

 If it was possible to force a subquery pushdown this could be achieved as

 {{{#!python
 query1 = Products1.objects.filter(foo="bar")
 query2 = Products2.objects.filter(foo="baz")
 query1.union(query2).as_subquery("release_date",
 "price").values("release_date").annotate(
     min_price=Min("price"), max_price=Max("price")
 )
 }}}

 I'm not convinced that having `.annotate` perform an implicit subquery
 pushdown when performed against a composite query is something we should
 focus on given a subquery pushdown mechanism seem more versatile. In all
 cases we need such mechanism to exist in the first place which is what
 #24462 focuses on.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35146#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d466c3efa-6ab6c7ff-2817-40a8-920a-0e298585507d-000000%40eu-central-1.amazonses.com.

Reply via email to