-
Notifications
You must be signed in to change notification settings - Fork 137
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
Extension Loading - tracking issue #1202
Comments
Short feedback regarding sqlite_scanner and reading: not working yet. We tried it with some in-house sqlite files, but we can reproduce it with the chinook.sqlite from here: https://www.sqlitetutorial.net/sqlite-sample-database/. In duckdb (this works): INSTALL sqlite;
LOAD sqlite;
CALL sqlite_attach('chinook.sqlite');
PRAGMA show_tables;
SELECT count(*) FROM Albums; in the shellwip (not yet working): LOAD sqlite_scanner;
.files add
.files list
CALL sqlite_attach('chinook.sqlite');
PRAGMA show_tables;
SELECT count(*) FROM Albums; |
Thanks! Testing has been basically non-existent (a big todo is reusing CLI tests), since work has been mostly put towards infrastructure, glass 1/10th full is that it loads / register the function, will have to dig further, this is a good testcase. I have update the support table here: https://github.com/duckdb/duckdb-wasm-wip#support-table, and opened a separate issue dedicated to sqlite extension. |
Understandable. A pleasure to be a guinea pig👍 |
I don't know if this is helpful at all, but you might look at how Pyodide enables package loading in Wasm: https://pyodide.org/en/stable/usage/loading-packages.html Perhaps some similarities to what you're trying to enable in duckdb-wasm. I don't know how this works under the hood, but from an end-user perspective, it seems to work well. (excited about this!) |
Thanks! This project has indeed quite some similarities, and it's nice to see they are using the same underlying mechanism for dynamic linking. As per the JavaScript API, this might end up 'stealing': await pyodide.loadPackage(["cycler", "pytz", "https://someURL/package"]); to load a given set of packages/extensions. |
Thanks @pmm-motif! JSON I think it's also a case where uniform support with duckdb's CLI is a great advantage. An update is that I am working toward distributing the wip packages so that it can be easily deployed and experimented on the wild. One details that I was missing is: where to look extensions up? function getExtensionPath(shortName, bundle) {
return "./my/extension/folder/" + bundle + "/" + shortName + "extension.wasm";
} that allows to customize extension-loading logic to whatever folder configuration you might have. At that point whatever seems a sensible default could be easily overridden. |
Hi @carlopi, just wanted to check what's the status of that. Tried to find some instructions how to use duckdb-wasm-wip (other than the shellwip project) but haven't found anything yet |
Very excited about this - great work! I have a bit of feedback after using the wip shell https://shellwip.duckdb.org. I was able to install & load the icu extension successfully, but the
|
is it possible to use this custom build of duckdb-wasm outside of https://shellwip.duckdb.org/? |
I just installed duckdb-wasm in my next js project and tried importing JSON. I keep getting I saw it's not loading JSON extension wasm file at all. Is this still an open issue or am my setup is missing something ? |
Thank you for investing time making extensions work in wasm, this is so so useful. This article indicates that the spatial extension should work with wasm: https://duckdb.org/2023/12/18/duckdb-extensions-in-wasm.html But trying this on the web shell gives these results: Interestingly, running this locally actually works just fine (yay!), but it would be nice to demo this with the web shell. Also the docs here: https://duckdb.org/docs/api/wasm/extensions#list-of-officially-available-extensions don't list the spatial extension yet either? |
@chriszrc IMHO it works to load the spatial extension, at least with SQL Workbench: https://sql-workbench.com/#queries=v0,INSTALL-spatial~,LOAD-spatial~,SELECT-*-FROM-st_drivers()~ |
We have put up a very experimental deployment at https://shellwip.duckdb.org/ that include experimental loading of extensions.
The idea is https://shell.duckdb.org/ is the stable and recommended deployment, but shellwip can be used over time to gather feedback and iterate on new features.
WARNING: Do not rely on any shellwip behaviour, and use it at your own risk!
Extensions in DuckDB
Extensions are a powerful addition to DuckDB, there are a few in-tree (as in, they are opt-in but code lives in the main duckdb/duckdb repo), then over time DuckDB Labs rolled out a few others (eg sqlite_scanner), and now an extension-template is out to facilitate anyone to build their own custom extension.
Extensions in DuckDB-Wasm
DuckDB-Wasm is currenlty deliver with a predefined set of in-tree extensions loaded by default, but we want to add runtime loading of generic extensions.
Currently live in shellwip there is a custom build of duckdb-wasm that allows loading of extensions, both via name or providing an URL.
Here (https://github.com/duckdb/duckdb-wasm-wip#readme) there are some additional explanations, missing features, some instructions and table with updated status for the various extensions (does it compile? does it work?).
Proper testing has NOT been performed (yet), and based on the feedback we might end up changing completely some aspects, but we hope that putting this out is a first big step in having down the line full support for extensions in duckdb-wasm.
Feedback wanted!
It would be wonderful if you could have a look, try some things, and give feedback (here, in a separate issue or Discord).
Some open issues where feedback are especially relevant are:
How this should be deployed by duckdb-wasm embedders
JavaScript API
Compatibility across toolchains [Rust?]
Currently Emscripten C/C++ toolchain is required for building extensions, and there are questions on how much flexibility there is across different compilers/tooling versions.Rust Wasm extensions support would be great, there are some ideas on how to make this work via C-wrapper, but work is needed.
Thanks! -> https://shellwip.duckdb.org/
The text was updated successfully, but these errors were encountered: