I wanted to mention a small point as I continued to Write Through SQL Server. When we create a database on different computers, there are times when we want to move it to our own computer or to another computer. Or we want to share the database with someone via file. We may wish to carry our database with these and similar needs in different projects.
Data Migrations Python
You have implemented your project using SQLite database and after a while you have not enough SQLite. You want to move your database to databases such as MySQL or postgresql. It’s pretty easy to do this with Django. Because you already use the ORM structure, there is no change in your code. Just settings.py you must change your database configurations in the file. This is not the case. The first thing we need to do is run the following command in our existing project.
Database Change with Django
$ python manage.py dumpdata > dump.json
With this command, we get the dump of the database in JSON format. Then, after changing our configuration, database has changed and we lost our old data. For example, we wanted to switch to MySQL when using SQLite database. After setting the configuration to MySQL, we run the following commands in order:
$ python manage.py migrate
$ python manage.py loaddata dump.json
if you have any issue please comment, thanks for reading.