What is the simplest way to move data from sqlite3 tables to posgressql in Django project
CodePudding user response:
To perform a data backup, we use the following command:
python manage.py dumpdata > data.json #use this command adding before postgres in django
This command will generate a data.json file in the root of your project, meaning you generated the dumpdata from SQLite and stored it in JSON format.
Sync Database
python manage.py migrate --run-syncdb #Use this command only after creation of postgres in django.
Load Data
This command will change the database backend to PostgreSQL.
python manage.py loaddata data.json #This command dumps your previous data from SQlite into postgres.