Opened 3 weeks ago
Closed 7 days ago
#37143 closed Bug (fixed)
aiterator() missing check for chunk_size=None after prefetch_related()
| Reported by: | Jacob Walls | Owned by: | zky |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 5.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Simon Charette | 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
aiterator() is missing the check found in iterator() for chunk_size=None after prefetch_related():
iterator() version:
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.
Change History (10)
comment:1 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 3 weeks ago
| Has patch: | set |
|---|
comment:3 by , 3 weeks ago
follow-up: 5 comment:4 by , 2 weeks ago
| Cc: | added |
|---|---|
| Needs documentation: | set |
| Patch needs improvement: | set |
Needs a release note, and now that I think of it, probably a deprecation path as well given that we accidentally supported this.
comment:5 by , 2 weeks ago
Replying to Jacob Walls:
Needs a release note, and now that I think of it, probably a deprecation path as well given that we accidentally supported this.
I have changed the behavior from raising an exception to issuing a deprecation warning.And I have also added/updated the documentation.
comment:6 by , 2 weeks ago
| Patch needs improvement: | unset |
|---|
comment:7 by , 10 days ago
| Patch needs improvement: | set |
|---|
comment:8 by , 8 days ago
| Patch needs improvement: | unset |
|---|
comment:9 by , 8 days ago
| Needs documentation: | unset |
|---|---|
| Triage Stage: | Accepted → Ready for checkin |
https://github.com/django/django/pull/21425