Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite3: safe multitask read & write - how to?

I have two programs: the first only write to sqlite db, and the second only read. May I be sure that there are never be some errors? Or how to avoid from it (in python)?

like image 309
scythargon Avatar asked Feb 24 '26 02:02

scythargon


1 Answers

Yes, it is generally safe.

According to the SQLite FAQ:

Multiple processes can have the same database open at the same time. Multiple processes can be doing a SELECT at the same time. But only one process can be making changes to the database at any moment in time, however.

Since only one of your processes is writing, this is fine.

Exception: This may break if your .sqlite file is stored on a network drive (Windows or NFS).

like image 142
Mechanical snail Avatar answered Feb 25 '26 14:02

Mechanical snail