Use Django dumpdata to dump a subset of overall data?
Asked Answered
W

2

16

I'm trying to use dumpdata to generate JSON for a database that is sufficiently large for django to take a long, long time to output. Is there any way to dump only a subset of the fields; say, 100, for testing?

I'm using MySQL and Django 1.0.

Weever answered 28/4, 2010 at 23:51 Comment(1)
possible duplicate of Django Selective DumpdataHemstitch
T
17

A 3rd party django app, django-test-utils contains a makefixture command implementation which is basically a smarter dumpdata. You can specify exact model names with ID ranges to export (and it will follow related objects) Example: manage.py makefixture --format=xml --indent=4 proj.appname.modelname[1:101] > test.xml

Tortricid answered 29/4, 2010 at 7:9 Comment(0)
I
1

See also Django Selective Dumpdata which suggests Django Fixture Magic

Isadora answered 11/6, 2014 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.