3

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.