Public
Edited
Jan 27, 2024
Insert cell
Insert cell
url = "https://cdn.rawgit.com/mdn/webassembly-examples/master/understanding-text-format/add.wasm"

Insert cell
window.WebAssembly
.instantiateStreaming(fetch("https://github.com/haneensa/sqltutor/blob/gh-pages/assets/duckdb-browser-eh.worker.f56e60a7.js"))
Insert cell
add(1,4)
Insert cell
duckdb = import("https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.17.0/+esm")
Insert cell
bundles = duckdb.getJsDelivrBundles()
Insert cell
//bundles.eh.mainModule = "https://github.com/haneensa/sqltutor/blob/gh-pages/assets/duckdb-eh.bf54ad97.wasm"
Insert cell
//bundles.eh.mainWorker = "https://github.com/haneensa/sqltutor/blob/gh-pages/assets/duckdb-browser-eh.worker.f56e60a7.js";
Insert cell
//bundles.mvp.mainModule = "https://github.com/haneensa/sqltutor/blob/gh-pages/assets/duckdb-mvp.5d941c9a.wasm"
Insert cell
//bundles.mvp.mainWorker = "https://github.com/haneensa/sqltutor/blob/gh-pages/assets/duckdb-browser-mvp.worker.027ded14.js"
Insert cell
bundle = duckdb.selectBundle(bundles)
Insert cell

viewof source = html`<input type=file accept=".js">`
Insert cell
async function makeDB() {
const logger = new duckdb.ConsoleLogger();
const worker = await duckdb.createWorker(import(URL.createObjectURL(source)));
const db = new duckdb.AsyncDuckDB(logger, worker);
await db.instantiate(bundle.mainModule);
return db
}
Insert cell
makeDB()
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more