Skip to content
No description or website provided.
Python
Find file
Latest commit 462cfdf Feb 21, 2013 @dcramer Merge pull request #2 from mattrobenolt/patch-1
Fix for Django 1.4
Failed to load latest commit information.
datatools Fix for Django 1.4 Feb 21, 2013
tests A start to tests Aug 31, 2012
.gitignore Initial commit of dumpdata command Oct 18, 2011
LICENSE Proper license Oct 18, 2011
README.rst Efficiency and cleanup for dumpdata May 23, 2012
runtests.py A start to tests Aug 31, 2012
setup.py A start to tests Aug 31, 2012

README.rst

django-data-tools

A set of utilities and improvements for managing data (fixtures specifically) in Django.

Install

INSTALLED_APPS = (
    # ...
    'datatools',
)

Commands

dumpdata

An improved version of the manage.py dumpdata command:

  • Adds a --limit option to specify the maximum number of objects per model to fetch.
  • Adds a --sort option to specify ascending or descending order for serialization.
  • Automatically follows the dependency graph for ForeignKeys and ManyToManyFields.
# Retrieve the latest 10000 thread objects with all their required dependencies
python manage.py dumpdata forums.thread --limit=10000 --sort=desc

Utilities

RangeQuerySetWrapper

Efficient iteration over a large collection of database objects, using a standard range pattern on the primary key.

from datatools.query import RangeQuerySetWrapper

qs = RangeQuerySetWrapper(Model.objects.all(), limit=100000)
for obj in qs:
    print "Got %r!" % obj
Something went wrong with that request. Please try again.