#35159: dumpdata does not work in 5.0.1 on QuerySets with prefetch_related
-------------------------------------+-------------------------------------
Reporter: Andrea F | Owner: nobody
Type: Bug | Status: new
Component: Core | Version: 5.0
(Management commands) | Keywords: dumpdata chunk_size
Severity: Normal | iterator prefetch_related
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
The `./manage.py dumpdata` management command calls `iterator()` on the
QuerySets of the models, but it does not pass
`chunk_size`([
https://github.com/django/django/blob/main/django/core/management/commands/dumpdata.py#L222]).
On model QuerySets that include `prefetch_related`, this now (with 5.0)
causes this error while running `dumpdata`:
> CommandError: Unable to serialize database: chunk_size must be provided
when using QuerySet.iterator() after prefetch_related().
Proposed fix is to pass a suitable `chunk_size` parameter to `iterator()`
within `handle()` in `dumpdata.py`.
--
Ticket URL: <https://code.djangoproject.com/ticket/35159>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.