Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading SQLite databases from a remote URL #6

Open
psychemedia opened this issue Feb 7, 2022 · 6 comments
Open

Loading SQLite databases from a remote URL #6

psychemedia opened this issue Feb 7, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@psychemedia
Copy link

psychemedia commented Feb 7, 2022

The jupyterlite/xeus-sqlite-kernel currently seems to require users to create a database as part of a script before they can query it, rather than connect to a sqlite file shipped as part of a JuptyerLite distribution or uploaded to it, or connect to a remote database file.

The phiresky/sql.js-httpvfs Javascript package wraps a SQLite emscripten distribution and also provides a virtual filesystem that allows the SQLite database to access very large remote SQLite databases (if configured appropriately) in an efficient way.

I wonder if this approach could be used to support remote connections from the xeus-sqlite-kernel? Users could then use a simple web server to publish both the JupyterLite environment, and even a large database, and then query the database efficiently from their browser?

The SQLime browser based SQlite playground (nalgeon/sqlime) also offers some interesting "web integrations", as described on its About SQLime page. For example, SQL files can be hosted Github gists, the gist id passed via a URL parameter to SQLime, then loaded and run by the playground when the page is loaded. (Databases files can also be uploaded from the desktop to the playground environment.)

image

The Basthon in-browser notebook [repo] & SQLite kernel loads a database from a file path specified via a URL parameter:

image

(I also note here examples of using custom javascript functions to create custom sqlite functions.)

@psychemedia psychemedia added the enhancement New feature or request label Feb 7, 2022
@DerThorsten
Copy link
Collaborator

DerThorsten commented Feb 7, 2022

@psychemedia there is a PR here jupyter-xeus/xeus-sqlite#119
with that one can fetch databases with
%FETCH <URL> <FILENAME>
and load them with
%LOAD <FILENAME> RW
one can then persist the virtual filesystem into the browsers indexed db, that way one only needs to do the fetching once

@psychemedia
Copy link
Author

Interesting, thanks..:-)

I take it that downloads the whole db, eg compared to the sql.js-httpvfs approach where the idea is you can connect to large remote databases and then just pull what you need chunks at a time?

Still v. useful though :-)

@jamietanna
Copy link

jamietanna commented Dec 27, 2023

Is it worth closing this, now jupyter-xeus/xeus-sqlite#119 has been released? 👀

@westurner
Copy link
Contributor

westurner commented Nov 27, 2024

xeus-sqlite-interpreter > void interpreter::parse_SQLite_magic > %FETCH <url> <filename> https://github.com/jupyter-xeus/xeus-sqlite/blob/ce5a598bdab29eb6aab78a78d0caee93c292ec74/src/xeus_sqlite_interpreter.cpp#L191

xlite.cpp >
void fetch(const std::string url, const std::string filename)
https://github.com/jupyter-xeus/xeus-sqlite/blob/ce5a598bdab29eb6aab78a78d0caee93c292ec74/src/xlite.cpp#L38

@westurner
Copy link
Contributor

@DerThorsten
Copy link
Collaborator

PRs are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants