Moving large dataset across django databases
What's the best way to move large dataset from one django database to another?
I would like to do this at high level (in django) and not at the database level. All the existing tools that I know of (dumpdata/loaddata, serializer class, django-extensions) are in memory so it doesn't handle large datasets.
I found this post very useful - Migrating Django from MySQL to PostgreSQL the Easy Way.
I had the same problem with several apps/databases, so wrote this script, which is a fork of django's dumpdata, but dumps data in chunks to avoid MemoryError
Script is available at https://github.com/fastinetserver/django-dumpdata-chunks
1) Dump data into many files:
mkdir some-folder ./manage.py dumpdata_chunks your-app-name --output-folder=./some-folder --max-records-per-chunk=100000
2) Load data from the folder:
find ./some-folder | egrep -o "([0-9]+_[0-9]+)" | xargs ./manage.py loaddata