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.
You can also use values():
from chunkator import chunkator for item in chunkator(LargeModel.objects.values('pk', 'name'), 200): do_something(item)
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.5.tar.gz
.
File metadata
- Download URL: django-chunkator-0.0.5.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0630dc4011a633231e91bcbb7cd4b864b3fd5393773a15a9a83799908279333e |
|
MD5 | 4538764f8ef6f41ad0fc7bbed5deeef8 |
|
BLAKE2b-256 | 36293d8ca4fa4d3a3a66ec90c4badc82f1dc5ba7bbe91cb6e2ff40ff2a30d6a3 |