#35146: Add support for annotate after union
               Reporter:  Alexandru  |          Owner:  nobody
  Chirila                            |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
 This is currently not supported, and the ORM rightly throws an error
 whenever you attempt to do so. I believe it would be beneficial to have
 such support allowing a query like this be generated

 SELECT release_date AS release_date,
        MAX(price)   AS max_price,
        MIN(price)   AS min_price
 FROM (SELECT release_date, price
       FROM products_1
       WHERE foo = 'bar'
       SELECT release_date, price
       FROM products_2
       WHERE foo = 'bar') AS products_subquery
 GROUP BY release_date

 Which might look something like this in the ORM

 query1 = Products1.objects.filter(foo="bar")
 query2 = Products2.objects.filter(foo="bar")
     min_price=Min("price"), max_price=Max("price")
Ticket URL: <https://code.djangoproject.com/ticket/35146>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to