Migrating Existing Data From Sqlite to Other Databases

When we begin our learning journey with Django we use the default database i.e., sqlite. It is very much enough for development and learning purposes. But as we make progress with our project and/or want to switch to a high end databases like MySQL,PostgreSQL etc. we will have to transfer our existing data to the new database.

python manage.py dumpdata -o data.json --format json

Change the settings.py file and connect to another database. After that

python manage.py migrate
This would create the tables according to the models we have made in the new database.

python manage.py loaddata data.json
If run successfully. All the data will be transferred to the new database.

Advertisements

Day 26

Have started a solving a programming exercise question from this Github repository. I have taken a task of 5 questions per day and will be pushibg these to my Github Account. This programming exercise has 3 levels of difficulty from Beginner to Advanced. So I will have a good grasp over Python Language.

Day 22

Still stuck on the same PR. There has been a lot of confusion about what should be done and different reviewers giving different suggestions regarding the pr. So I have been listening to all of them and applying the changes as requested. I just hope that it gets merged till tomorow as I am kinda bored with this one and want to work on somehing new. So let’s see what happens tomorrow.