sqlite - works with file, dies with :memory:

You cannot create multiple connections to an in-memory database. Instead, a new connection to :memory: creates a new database.

From the SQLite documentation:

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.

This is different from an on-disk database, where creating multiple connections with the same connection string means you are connecting to one database.

You are creating a new connection for the thread, thus creating a new database that does not have the tables created.