Chunk large querysetsinto small chunks, and iterate over them without killing your RAM.
Project description
Chunk large querysetsinto 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.
Warning:
This will not accelerate your process. Instead of having one BIG query, you’ll have several small queries. This will save your RAM instead, because you’ll not load a huge queryset result before looping on it.
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
File details
Details for the file django-chunkator-0.0.3.tar.gz
.
File metadata
- Download URL: django-chunkator-0.0.3.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e21e3362161ae20982cd369c315c4e474364645a59d992e5756113e02a236e37 |
|
MD5 | 4a391ed612363fd7f555de06d48b19f5 |
|
BLAKE2b-256 | 2662fd225af4a85985496f24d35c38c6d64686a9360834aaa6c14659495d0ea2 |