Skip to content

Creating shared memory database fails #1032

@AxelTerizaki

Description

@AxelTerizaki

Hello.

I'm trying to create a database in memory, run some queries on it to create tables, and then attach that same database to another one.

According to the sqlite3 documentaiton, you can create shared memory databases.

https://www.sqlite.org/inmemorydb.html see the "In-memory Databases And Shared Cache" section.

I tried something like that, but it fails :

> var sqlite3 = require('sqlite3').verbose();
undefined
> var db = new sqlite3.Database('file::memory:?cache=shared');
undefined
> events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: SQLITE_CANTOPEN: unable to open database file

I could always attach the memory database first and then run queries on it, but since I'm reusing queries I already ran elsewhere, I'd have to copy/paste them to change table names (table1 to memorydb.table1) for example.

This works fine when using a sqlite3 client in bash.

Would it be possible to implement it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions