Jiloc Jiloc - 1 year ago 218
Python Question

Django loaddata - Out of Memory

I made a dump of my db using dumpdata and it created a 500mb json file

now I am trying to use loaddata to restore the db, but seems like Django tries to load the entire file into memory before applying it and i get an out of memory error and the process is killed.

Isn't there a way to bypass this problem?

Joe Joe
Answer Source

loaddata is generally use for fixtures, i.e. a small number of database objects to get your system started and for tests rather than for large chunks of data. If you're hitting memory limits then you're probably not using it for the right purpose.

If you still have the original database, you should use something more suited to the purpose, like PostgreSQL's pg_dump or MySQL's mysqldump.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download