Radio Controlled Radio Controlled - 4 months ago 12
Bash Question

python / sqlite3 - Which is the process writing the file?

If I build a database using sqlite3 from within python, what will be the process called that edits the database file?

Will I be able to notice from shell that a database is not closed - even if no inserts are currently being committed?

CL. CL.
Answer

SQLite is an embedded database, so there is no separate process.

You can check with lsof or similar tools whether the Python process has an open handle to the database file. However, such a handle corresponds to an open connection; it does not tell you whether there is an active transaction.

A transaction locks the DB file; you can try to check for that with lslk or lslocks. But if you actually want to do something with the DB, it might be a better idea to use the synchronization mechanisms of SQLite itself, and to try to execute BEGIN EXCLUSIVE.