]> 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:50 +0000 (18:11 -0400)
commita3f08579ac445fc32a221d86770f1dd350a1cfc2
tree6fe16ce5ec2271a43e8f114768c59319296d0515
parent0af0f19f1195cd0a2a78ed7e3ba34bbb11c07f63
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
(cherry picked from commit 702a7f11dd8a9d3dae30048aa3d2fc0197330d88)
lib/sqlalchemy/dialects/sqlite/aiosqlite.py
lib/sqlalchemy/dialects/sqlite/pysqlite.py