Skip to content

Support opening remote SQLite databases and export #225

@john-guerra

Description

@john-guerra

Loading sqlite databases from FileAttachments it is very convenient, but greatly limits the use of the library. It would be nice to easily load remote databases as @mbostock demonstrated in the original sqlite

I'm thinking something like SQLiteDatabaseClient.open that does:

  async open(url) {
     const  db = new SQLite.Database(
        new Uint8Array( await fetch(url).then(res => res.arrayBuffer() ) )
      );
     return new SQLiteDatabaseClient(db);   

Also an export that does something like this._db.export(), and even better a download() that does the whole DOM.download(async () => new Blob([await db._db.export()]), "mydb.db") as I did in my export example

Also, for me it has been very confusing what the SQLite object in a new notebook is. If I'm understanding correctly, it is just sql.js right? It would be nice to have also a method of creating a new Database as in new SQLite.Database() but actually getting a database client object.

BTW I cannot access SQLiteDatabaseClient from a notebook, right?

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