Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limiting the amount of fixtures in django dumpdata

Tags:

django

One of our servers has 4 gb of data. But as of now i am only interested in populating only little data for fixtures. One easy of dumping data is:

 python manage.py dumpdata --indent=4 > shipping_fixture.json

but the trouble with this is that it dumps all the data into the database. Working with such a massive amount of data on the test does not make any sense. Is there any way out where i can limit the amount of data that does not make things heavy for me, and the data i downloaded is complete in itself.

like image 221
user993563 Avatar asked Jun 21 '12 10:06

user993563


1 Answers

The latest django (1.5.5) doesn't have such an option, but I think it's coming up soon in a future version. There is currently a ticket implementing a new feature to the dumpdata command that will allow you to filter what gets outputted based on the primary key if the model is specified.

A 3rd party app called django-test-utils can probably do what you need.

Use Django dumpdata to dump a subset of overall data?

like image 192
janos Avatar answered Oct 29 '22 18:10

janos