Reputation: 439
I'm switching my database engine and need to convert my data. I can access both databases in a python shell with .using('[database]')
. Does django have any built-in backup&restore functions that I could use to fill my empty(but migrated) new database?
Upvotes: 0
Views: 216
Reputation: 9917
You can use dumpdata
to export and loaddata
to import.
Here are some examples:
python manage.py dumpdata > all.json
python manage.py dumpdata blog > blog.json
python manage.py dumpdata blog.articles > blog_articles.json
python manage.py loaddata all.json
By changing the settings.py
database connection after you've dumped your data you don't have to use using
at all.
More on this in the Django Docs.
Upvotes: 1