Opened 19 hours ago

#37430 assigned Cleanup/optimization

Clarify database selection when a queryset is used in an {{{__in}}} lookup:

Reported by: Lev Zlobin Owned by: Lev Zlobin
Component: Documentation Version: dev
Severity: Normal Keywords: documentation queryset multiple-databases subquery routing
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

  • Without an explicitly selected database, the subquery uses the outer query's connection rather than being routed independently.
  • Explicitly selecting a different database for the inner queryset raises ValueError.
  • Evaluating the inner queryset with list() allows values to be retrieved from another database.

Add examples to the multiple-databases guide and cross-references from the using() and in lookup documentation.

This documentation improvement was split out from https://code.djangoproject.com/ticket/37427 following review on github ​https://github.com/django/django/pull/22154.

Change History (0)

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