#37143: aiterator() missing check for chunk_size=None after prefetch_related()
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: Database
| layer (models, ORM)
Version: 5.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
`aiterator()` is missing the
[
https://github.com/django/django/blob/4bbc27c8686f10f9556cef02dbfa9f5157fbcf56/django/db/models/query.py#L566
check] found in `iterator()` for `chunk_size=None` after
`prefetch_related()`:
`iterator()` version:
{{{#!py
if chunk_size is None:
if self._prefetch_related_lookups:
raise ValueError(
"chunk_size must be provided when using
QuerySet.iterator() after "
"prefetch_related()."
)
}}}
I think this should have been implemented in #34331.
The rationale for the check was to alert users that the number of queries
could spike with small batch sizes, which you might be tempted to minimize
if prioritizing memory optimizations.
--
Ticket URL: <
https://code.djangoproject.com/ticket/37143>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.