mercredi 17 février 2016

Concurrent Sqlite3: One writing and multiple reading connections

I would like to produce the following set up in Python 3.4:

(1) Create an in-memory shared-cache SQLite3 database. This is what I have been working with so far (this works):

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

(2) Create one connection that only writes to this DB from one thread

(3) Create multiple connections that concurrently read from this DB from various other threads

From what I have gathered, if I add isolation_level=None and execute PRAGMA journal_mode=wal in my connections, this should do the trick but I am still getting locking errors.

Aucun commentaire:

Enregistrer un commentaire