diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-31 16:10:05 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-31 16:10:50 +0100 |
| commit | 7453d6a80792e3f811fc662b8b25fdcbc5ea7eb3 (patch) | |
| tree | af200ac40bea58431ea91c2efd6698e21ae70ddd /django/core/management/commands/dumpdata.py | |
| parent | 2822cafa3c38c8352eacb82aad27cc29338d8ad7 (diff) | |
[5.0.x] Fixed #35159 -- Fixed dumpdata crash when base querysets use prefetch_related().
Regression in 139135627650ed6aaaf4c755b82c3bd43f2b8f51
following deprecation in edbf930287cb72e9afab1f7208c24b1146b0c4ec.
Thanks Andrea F for the report.
Backport of 38eaf2f21a2398a8dd8444f6df3723898cb5fe2a from main
Diffstat (limited to 'django/core/management/commands/dumpdata.py')
| -rw-r--r-- | django/core/management/commands/dumpdata.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/core/management/commands/dumpdata.py b/django/core/management/commands/dumpdata.py index cc183517e3..01ff8974dd 100644 --- a/django/core/management/commands/dumpdata.py +++ b/django/core/management/commands/dumpdata.py @@ -219,7 +219,10 @@ class Command(BaseCommand): if count_only: yield queryset.order_by().count() else: - yield from queryset.iterator() + chunk_size = ( + 2000 if queryset._prefetch_related_lookups else None + ) + yield from queryset.iterator(chunk_size=chunk_size) try: self.stdout.ending = None |
