Opened 3 weeks ago

Closed 6 days ago

Last modified 6 days ago

#36605 closed New feature (fixed)

Support chaining `QuerySet.in_bulk()` after `.values()` or `.values_list()`

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Per new-features#74 , supporting values()/values_list() to be chained with in_bulk() would allow fetching limited columns while obeying database parameter limits. The implementation for #28586 would benefit from it, at least.

#35690 improved the error message for these currently-unsupported cases, but also had an associated PR trying to add support: https://github.com/django/django/pull/18497 . We can revive this PR and finish it off.

Change History (6)

comment:1 by Jacob Walls, 3 weeks ago

Triage Stage: UnreviewedAccepted

comment:2 by Jacob Walls, 13 days ago

Patch needs improvement: set

comment:3 by Adam Johnson, 7 days ago

Patch needs improvement: unset

comment:4 by Jacob Walls, 7 days ago

Triage Stage: AcceptedReady for checkin

comment:5 by Jacob Walls <jacobtylerwalls@…>, 6 days ago

Resolution: fixed
Status: assignedclosed

In 1820d35:

Fixed #36605 -- Added support for QuerySet.in_bulk() after .values() or .values_list().

co-authored-by: Adam Johnson <me@…>
co-authored-by: Simon Charette <charette.s@…>

comment:6 by Jacob Walls <jacobtylerwalls@…>, 6 days ago

In 46bd9227:

Refs #36605 -- Optimized QuerySet.in_bulk() for the empty id_list case.

Now that the setup is a bit more expensive, it makes sense to return earlier
for the empty case.

Note: See TracTickets for help on using tickets.
Back to Top