#33015: QuerySet.extra Use Case: filtering on large lists of tuples
-------------------------------------+-------------------------------------
Reporter: kris-swann | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: QuerySet.extra, | Triage Stage: Accepted
Documentation |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* resolution: => fixed
* status: new => closed
Comment:
John's example won't work as-is because we still lack support for non-
primary key composite fields (see #373 and/or #5929 still not clear which
one should be the home for composite field support) which prevents the
`Tuple` function from exposing an `output_field = CompositeField(...)`
that would have an `__in` lookup resolving to `TupleIn`.
What will work though is the following
{{{#!python
from django.db.models.fields.tuple_lookups import Tuple, TupleIn
ExampleModel.objects.filter(
TupleIn(Tuple("val1", "val2"), items_to_fetch)
)
}}}
So I'll close this ticket as fixed since `Tuple` and `TupleIn` should be
released as part of Django 5.2 so this request was effectively resolved by
1eac690d25dd49088256954d4046813daa37dc95.
--
Ticket URL: <https://code.djangoproject.com/ticket/33015#comment:9>
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 visit
https://groups.google.com/d/msgid/django-updates/01070193daf5afc3-4a572c9d-4b25-4125-b10c-c17429e9fe7b-000000%40eu-central-1.amazonses.com.