Skip to content

Instantly share code, notes, and snippets.

@mlissner
mlissner / test.txt
Created September 2, 2014 15:32
Testing Gist Ownership Transfer
asdf
@mlissner
mlissner / queryset_generators.py
Created March 10, 2012 04:13 — forked from dbrgn/queryset_generators.py
Adds a date-based queryset generator
from datetime import datetime
from datetime import timedelta
def queryset_generator(queryset, chunksize=1000):
"""
Iterate over a Django Queryset ordered by the primary key
This method loads a maximum of chunksize (default: 1000) rows in its
memory at the same time while django normally would load all rows in its
memory. Using the iterator() method only causes it to not preload all the