Is it possible to share an in memory SQLite database using SQLAlchemy among multiple Python processes? All applications are reading and writing from/to it. If so, is it desirable?
Asked
Active
Viewed 1,152 times
1 Answers
1
No, you cannot share an in-memory SQLite database between processes. An in-memory SQLite database is private to the connection that created it; even within the same process, a new connection to :memory:
creates a new database. SQLAlchemy does not lift this limitation.
You can only share a file-based database. SQLite uses as system of locking to make that possible.
That said, SQLite is not the best choice for concurrent database access. A database using a separate server to manage multiple clients (such as MySQL or PostgreSQL) is a better choice if performance is an issue.

Martijn Pieters
- 1,048,767
- 296
- 4,058
- 3,343