Skip to content

Instantly share code, notes, and snippets.

View jonathanmorgan's full-sized avatar

Jonathan Morgan jonathanmorgan

View GitHub Profile
@jonathanmorgan
jonathanmorgan / class2-test_drive.ipynb
Last active August 29, 2015 14:13
IPython Notebook with brief tests for software we'll use in class, to make sure it is installed correctly and working.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jonathanmorgan
jonathanmorgan / queryset_generators.py
Created March 10, 2012 21:29 — forked from mlissner/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
@jonathanmorgan
jonathanmorgan / queryset_iterators.py
Created May 6, 2011 05:40 — forked from dbrgn/queryset_generators.py
queryset_generator and queryset_list_generator
'''
queryset_generator and queryset_list_generator based on:
https://gist.github.com/897894
'''
#===============================================================================
# imports (in alphabetical order by package, then by name)
#===============================================================================
# python standard libraries