I am trying to create multiple in-memory databases with sqlite3 (if possible). For on-disk databases, I would do:
import sqlite3
db1 = sqlite3.connect('/mnt/tmp/db1.db')
db2 = sqlite3.connect('/mnt/tmp/db2.db')
db3 = sqlite3.connect('/mnt/tmp/db3.db')
If I instead do:
db1 = sqlite3.connect("file::memory:?cache=shared")
db2 = sqlite3.connect("file::memory:?cache=shared")
db3 = sqlite3.connect("file::memory:?cache=shared")
Will this result in three separate in-memory databases? This seems to create three connections to a shared in-memory database, which is not what I want.
I then proceed to create cursors on the databases (on-disk or in-memory) with:
cur_db1 = db1.cursor()
cur_db2 = db2.cursor()
cur_db3 = db3.cursor()
If multiple in-memory databases are not possible, is my best choice to use RAM-disk databases (as in my first code block), but then to execute "PRAGMA journal_mode=MEMORY" on these connections?
"file::memory:?cache=shared", then upon trying to execute aninserton a table created in one of the databases, I getOperationalError('database is locked',)