Moving tables data from sqlite3 to postgressql

Question:

What is the simplest way to move data from sqlite3 tables to posgressql in Django project

Asked By: Islam Fahmy

||

Answers:

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.
Answered By: Manoj Tolagekar
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.