lundi 12 janvier 2015

sqlalchemy and SQLite shared cache

SQLite supports a "shared cache" for :memory: databases when they are opened with a special URI (according to sqlite.org):



[T]he same in-memory database can be opened by two or more database connections as follows:


rc = sqlite3_open("file::memory:?cache=shared",&db);



I can take advantage of this in Python 3.4 by using the URI parameter for sqlite3.connect():



sqlite3.connect('file::memory:?cache=shared', uri=True)


However, I can't seem to get the same thing working for SQLAlchemy:



engine = sqlalchemy.create_engine('sqlite:///:memory:?cache=shared')
engine.connect()
...
TypeError: 'cache' is an invalid keyword argument for this function


Is there some way to get SQLAlchemy to make use of the shared cache?


Aucun commentaire:

Enregistrer un commentaire