0

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?

1 Answer 1

1

You can use dumpdata to export and loaddata to import.

Here are some examples:

dumpdata everything

python manage.py dumpdata > all.json

dumpdata one app

python manage.py dumpdata blog > blog.json

dumpdata specific model of app

python manage.py dumpdata blog.articles > blog_articles.json

loaddata

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.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks, I ran into a few problems importing but found those answers here: stackoverflow.com/questions/853796/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.