https://github.com/dcramer/django-data-tools
https://github.com/dcramer/django-data-tools
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dcramer/django-data-tools
- Owner: dcramer
- License: apache-2.0
- Created: 2011-10-18T19:56:40.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-02-21T22:45:19.000Z (over 12 years ago)
- Last Synced: 2025-03-15T15:17:39.855Z (3 months ago)
- Language: Python
- Homepage:
- Size: 135 KB
- Stars: 38
- Watchers: 7
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
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=descUtilities
---------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