0

I finished my big project in python which is in short a GUI to administrate a database. The datas stored in the database are really important and i want to be sure that if the server stop functionning i'll still have a backup of the database.

The thing is that my company server isn't really under my control so i'm not able to create for example a script to backup the database in the cloud or anywhere safe directly from the server using mysqldump. So i want to make a thing like everytime someone commit datas in the database from a client perspective, the database is backup. The problem is that the clients doesn't have mysql installed in their PCs so that i can't implement a mysqldump command in the app that would be executed by them.

To use mysql with python i used mysql.connector which works fine but i didn't find anywhere in the doc a way to use mysqldump with python nor an other library that could do the same in python. Is there a way to make the client create a mysql database backup using my python app ? Thank you !

  • an interesting question, but ultimately the question needs sufficient code for a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – D.L Aug 03 '23 at 17:30

1 Answers1

1

Producing dumps on database server is slow (depending on data size), locks tables or even the whole database during the process (or otherwise produces inconsistent backups), is heavy in size (the whole dataset in one file with INSERT statements).

Don't do it after each client transaction. Clients will not be happy.

If (a) "datas stored in the database are really important" but (b) "my company server isn't really under my control", then, logically, (c) it's not your responsibility to keep data safe, just let it go. A good DBA would create a read-only replica of the server to regularly run full backups on it and have enough binlog space for point-in-time recovery. This is their job. They are naturally paid for this. This topic has absolutely nothing to do with application development.

By the way, if your company does not have a DBA, then the (a) statement is simply incorrect. Or at least your company CTO does not consider it as "really important".

Stas Trefilov
  • 173
  • 1
  • 6
  • It's what i thought you're actually right on every points. I just wasn't sure why they'd put responsability on me but the thing is that all the servers and cybersecurity is done by the parent company. When i said the datas were important it was at the scale of our own activity but our parent company doesn't even know we exist ^^ – d'Elbreil Clément Aug 04 '23 at 07:09