Answer the question
In order to leave comments, you need to log in
How to dump MySQL from a networked PC in Python?
I am developing an application in Flask.
Now I use SQLite, but since I'm in the development stage, it is often necessary to change the structure of tables, and this is difficult, given the limitations of SQLite
. Decided to switch to MySQL.
On a network server, XAMMP is spinning. I want to use it.
But, there was a problem with transferring the actual database via git. There are no problems with SQLite, because one file.
Decided to make a MySQL database dump. Googled, everywhere they cite the use of mysqldump as an example. But I have the application locally in venv on one PC, and the db is online on another PC.
How to dump MySQL from a remote network PC (server) using Python3?
And of course - how to deploy the dump to the desired MySQL server?
Answer the question
In order to leave comments, you need to log in
mysqldump: can be called from a shell script during deployment. If you want, then it should work from python. Use the full path to mysqldump, and check that the user has permission to create the file.
Expand: mysql db_name < dump-name.sql
Slightly off-topic: the database itself should not be stored in git. It is more correct to store the structure, plus seed data. And to make out changes as migrations. Look for example at https://www.liquibase.org/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question