Public
Edited
Jun 6, 2024
2 forks
Insert cell
Insert cell
Insert cell
duckdb = import(
`https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@${version}/+esm`
)
Insert cell
duckdb.PACKAGE_VERSION
Insert cell
bundles = duckdb.getJsDelivrBundles()
Insert cell
bundle = duckdb.selectBundle(bundles)
Insert cell
async function makeDB() {
const logger = new duckdb.ConsoleLogger();
const worker = await duckdb.createWorker(bundle.mainWorker);
const db = new duckdb.AsyncDuckDB(logger, worker);
await db.instantiate(bundle.mainModule);
return db;
}
Insert cell
db = makeDB()
Insert cell
db.getVersion()
Insert cell
connection = {
const connection = await db.connect();
await connection.query(
"ATTACH 'https://huggingface.co/datasets/nyu-mll/glue/resolve/refs%2Fconvert%2Fduckdb/ax/test/index.duckdb' AS glue (READ_ONLY);"
);
return connection;
}
Insert cell
result = connection.query("SELECT * FROM glue.data LIMIT 10;")
Insert cell
Array.from(result)
Insert cell
result.toArray()
Insert cell
Inputs.table(result)
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