mitsuhiko/flask-sqlalchemy — pull request #80 by cenkalti (2012-06-04 17:02:46+00:00)
Title: Use StaticPool for in-memory sqlite databases

http://www.sqlite.org/inmemorydb.html

"When a connection opened to ':memory:', no disk file is opened. Instead, a new database is created purely in memory. The database ceases to exist as soon as the database connection is closed. Every :memory: database is distinct from every other. So, opening two database connections each with the filename ":memory:" will create two independent in-memory databases."

http://docs.sqlalchemy.org/en/rel_0_7/dialects/sqlite.html#using-a-memory-database-in-multiple-threads

"To use a :memory: database in a multithreaded scenario, the same connection object must be shared among threads, since the database exists only within the scope of that connection. The StaticPool implementation will maintain a single connection globally, and the check_same_thread flag can be passed to Pysqlite as False."