Chunk large QuerySets into small chunks, and iterate over them without killing your RAM.
Project description
Chunk large QuerySets into small chunks, and iterate over them without killing your RAM.
Usage
from chunkator import chunkator
for item in chunkator(LargeModel.objects.all(), 200):
do_something(item)
This tool is intended to work on Django querysets.
Your model must define a pk field (this is done by default, but sometimes it can be overridden) and this pk has to be unique. django- chunkator has been tested with PostgreSQL and SQLite, using regular PKs and UUIDs as primary keys.
You can also use values():
from chunkator import chunkator
for item in chunkator(LargeModel.objects.values('pk', 'name'), 200):
do_something(item)
License
MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-chunkator-1.0.0.tar.gz
.
File metadata
- Download URL: django-chunkator-1.0.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9b386836825d58ecc038efd95c2f72adbcbf9461b8af49e786d2aa512b97142 |
|
MD5 | 87e12575dec06d6d18dc71b825912e5f |
|
BLAKE2b-256 | 2f65c2f87fe01d3d362211330e427b82ea82585a72bbe6c602a73083ea6c8ace |
File details
Details for the file django_chunkator-1.0.0-py2-none-any.whl
.
File metadata
- Download URL: django_chunkator-1.0.0-py2-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96ff34628b650afe7424870ded1281cab85f8b2283453c7e72335a9c7b1ac6c3 |
|
MD5 | c8394c18b9b1e79d987c8940afb50fca |
|
BLAKE2b-256 | e7112bff962272d820ed573a23deddb1c6064a0e367ad469fe0b32439ed3cc7e |