[Twisted-Python] SQLite3 gives error when using adbapi

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sun Apr 25 10:16:31 EDT 2010


On 09:24 am, sleeepd at gmail.com wrote:
>I am try to use a in-memory sqlite db via adbapi, but sqlite gives
>error:" OperationalError: *no such table*: test ".
>
>how can I made it work?
>
>[snip]
>
>db = adbapi.ConnectionPool("sqlite3", database=":memory:")

It doesn't make sense to use a connection pool for an in-memory SQLite3 
database.  Every time you connect to ":memory:", you get a brand new, 
empty database.

If you want this to work, you need to be able to establish multiple 
connections to the same database.  You could do that by making your own 
DB-API 2.0 module that wraps sqlite3 and always hands back the same 
:memory: connection when its connect function is called.

Jean-Paul



More information about the Twisted-Python mailing list