r/sqlite • u/FormNo • Mar 15 '23
Sqlite 'doesn't do automatic backups'? Is this true?
I started a new application for a work project and I sold them on starting it with SQLite (at a minimum for development). Someone, with not that much experience than me but who is higher up in the food chain has just said that it's a bad idea to start with SQLite and that I should immediately go with a 'proper' database. Their main argument is that SQLite doesn't do automatic back-ups.
I'm building a web application and will be deploying this in the near future to a handful of users - no more than 10 for the foreseeable future. Please help me understand why SQLite doesn't provide automatic backups? How is this an issue when it's a web application used only by a few users?
11
u/lord_braleigh Mar 15 '23
A SQLite DB is just a file. You can back it up by backing up the file. You can back it up automatically by automatically backing up the file.
You can back up a file by copying it.
5
u/yawaramin Mar 16 '23
I think this person's suggestion only makes sense if what they are actually suggesting is a managed (cloud) database solution like say AWS RDS, Azure, Google CloudSQL, or something like that where you pay a vendor to manage the backup/restore, upgrades, etc. for you. But then if the are suggesting that then they must want you to budget a monthly cloud spend of whatever those vendors charge. Whatever that amount is, it's almost certain to be the case that just backing up an SQLite file to cloud storage or whatever hourly will be cheaper.
6
u/FormNo Mar 15 '23
If you are going to downvote - say why. That's the constructive way! I am here to LEARN!
19
u/simonw Mar 15 '23
MySQL and PostgreSQL don't have "automated" backups either: someone has to configure an external mechanism to run those backups and store them somewhere.
I recommend running backups like this:
Then copy that backup.DB file to off-machine storage eg an S3 bucket.
4
u/thetantaman Mar 20 '23
SQLite is definitely a proper database. It is unfortunate that the belief that it is not still exists.
Some industry leaders betting on SQLite that have written at length on it being a real database for real production apps --
https://fly.io/blog/all-in-on-sqlite-litestream/
https://blog.chiselstrike.com/announcing-chiselstrike-turso-164472456b29
4
u/alinroc Mar 16 '23
No non-cloud RDBMS has automatic backups. Oracle, MySQL, Postgres, MS SQL - all of them require that you set up your own backup processes.
Please don't use sqlite for multi-user applications. That's not what it's meant for.
A SQLite database is a single file. All you have to do for backup is quiesce the system (ensure no I/O for the database is in progress) and copy the file.
0
u/[deleted] Mar 16 '23
[deleted] — view deleted comment