django-chunkator
Chunk large QuerySets into small chunks, and iterate over them without killing your RAM.
What it is and what it does
django-chunkator provides a simple iterator that breaks a Django QuerySet into smaller batches, fetching and processing them one chunk at a time instead of loading the entire result set into memory. This is useful when you need to process large numbers of records but don't have enough RAM to hold them all at once. The package exports two main functions: chunkator() for iterating over individual items in chunks, and chunkator_page() for working with entire pages of results as lists.
The tool works by repeatedly querying the database with offset and limit, fetching each batch sequentially. It requires that your model has a unique primary key (which Django provides by default) and works with both standard integer PKs and UUIDs. The package has been tested with PostgreSQL and SQLite. Note that chunking does not speed up the overall process—it trades a single large query for multiple smaller ones, with the main benefit being reduced memory consumption during iteration.
Use it for:
- Bulk-update large numbers of records in a Django model without exhausting available RAM.
- Export large datasets to CSV or other formats by processing rows in manageable batches.
- Perform background tasks on all records in a table by chunking the queryset and dispatching each chunk to a task queue.
- Migrate or transform data from one table to another when the result set is too large to fit in memory.
- Generate reports or analytics by iterating over a large queryset in controlled increments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Iterates over large Django QuerySets in configurable chunks to avoid loading entire result sets into memory at once.
No. The package is abandoned (last release 2020-06-22, last commit 2022-07-11) and untested against Django versions beyond 3.0. Compatibility with modern Django and Python versions is unverified. For new projects, consider using Django's built-in QuerySet.iterator() with chunk_size parameter, which provides similar functionality and is actively maintained.
Install
django-chunkator on PyPI
pip
pip install django-chunkatoruv
uv add django-chunkatorpoetry
poetry add django-chunkatorInstalling django-chunkator
Before you install
Low install friction with a single Django dependency. However, the package is abandoned—last release was 2020-06-22, with no commits since 2022-07-11.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or distribution in proprietary or open-source projects.
Quickstart
pip install django-chunkator
from chunkator import chunkator
for item in chunkator(LargeModel.objects.all(), 200):
do_something(item)
Your Django model must define a unique pk field (the default), and the queryset must include it if using values().
Verify before relying
- Compatibility with Django versions released after 3.0 and Python versions after 3.8.
- Performance characteristics and memory savings on very large datasets.
- Whether the package functions correctly with modern dependency versions.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — django |
| Maintenance | abandoned — 2,244 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 178,291/month — #10,198 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_chunkator-2.0.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
django-cursor-paginationImplements cursor-based pagination for Django…
permissive · top 15,000 on PyPI
iterproxyWraps any iterable object to provide ORM-style…
permissive · top 5,000 on PyPI
django-queryset-csvExports Django QuerySet data to CSV format with…
copyleft · top 15,000 on PyPI
graphene-django-optimizerAutomatically optimizes GraphQL queries…
permissive · top 15,000 on PyPI
django-mock-queriesMocks Django QuerySet operations in memory for…
permissive · top 15,000 on PyPI
django-tables2django-tables2 generates HTML tables from…
permissive · top 5,000 on PyPI
django-sql-utilsProvides simplified APIs for Django querysets…
permissive · top 15,000 on PyPI
django-query-builderBuilds and executes complex SQL queries…
permissive · top 15,000 on PyPI
django-cacheopsAutomatic and manual ORM query caching for…
permissive · top 5,000 on PyPI
django-pg-returningExtends Django's ORM to capture and return rows…
permissive · top 15,000 on PyPI