[Django] #24047: Cannot combine values_list querysets that do subqueries

4 views
Skip to first unread message

Django

unread,
Dec 23, 2014, 7:19:04 PM12/23/14
to django-...@googlegroups.com
#24047: Cannot combine values_list querysets that do subqueries
-------------------------------+--------------------
Reporter: danni | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I have a query like:

{{{
qs1 = object.comments.values_list('author__email', flat=True)
qs2 = object.group.members('email', flat=True)
recipients = qs1 & qs2
}}}


Where author and members are both User objects. This tells me the fields
must match to do a combine. If I override the field by doing something
hacky like qs1.fields=['email'] it tells me the base classes must match to
do a combine.

--
Ticket URL: <https://code.djangoproject.com/ticket/24047>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 25, 2014, 7:02:09 AM12/25/14
to django-...@googlegroups.com
#24047: Cannot combine values_list querysets that do subqueries
-------------------------------------+-------------------------------------
Reporter: danni | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 1.6
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* component: Uncategorized => Database layer (models, ORM)
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted


Comment:

I am not sure if this can be made to work easily, but if not we could
document the limitation.

--
Ticket URL: <https://code.djangoproject.com/ticket/24047#comment:1>

Django

unread,
Apr 15, 2021, 12:29:47 AM4/15/21
to django-...@googlegroups.com
#24047: Cannot combine values_list querysets that do subqueries
-------------------------------------+-------------------------------------
Reporter: Danielle Madeley | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: 1.6
(models, ORM) |
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage: Accepted
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: => wontfix


Comment:

I think this should be ''wontfix''ed now that the ORM has support for
`QuerySet.intersection` and friends.

Adding multi-models support to queryset combinations would require massive
changes to the internals of `QuerySet` and `Query` objects.

--
Ticket URL: <https://code.djangoproject.com/ticket/24047#comment:2>

Reply all
Reply to author
Forward
0 new messages