]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
rewrite SQLite in-memory database docs for concurrency
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 12 Jul 2026 22:11:21 +0000 (18:11 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 12 Jul 2026 22:11:21 +0000 (18:11 -0400)
commit702a7f11dd8a9d3dae30048aa3d2fc0197330d88
treef4a2b9cdd8e28c5a285e093c34b7366e711898cc
parent07e2c9f4e97b120787d2c6cafc9ffe1a021479a9
rewrite SQLite in-memory database docs for concurrency

Rewrote the "Using a Memory Database in Multiple Threads" section
in the pysqlite dialect docs to lead with the fundamental constraint
that a :memory: database is scoped to a single connection, and is
not suitable for concurrent use without shared cache or full
serialization.

Added a new "Using a Shared-Cache Memory Database" subsection
recommending the file::memory:?cache=shared&uri=true URI approach,
which gives each checkout its own DBAPI connection with independent
transaction state while sharing one in-memory database.  Documented
process-global scoping and named databases for isolation.

Demoted the StaticPool approach to a secondary subsection with a
prominent warning about its single-connection limitation and silent
data loss under concurrent sessions.

Added a corresponding "Using a Memory Database with Multiple
Coroutines" section to the aiosqlite dialect docs, cross-referencing
the pysqlite shared-cache documentation.

References: #13428, #6987
Change-Id: Ic07c5a2a564e8eca19e596267f61051a2aaa0258
lib/sqlalchemy/dialects/sqlite/aiosqlite.py
lib/sqlalchemy/dialects/sqlite/pysqlite.py