Open tobilg opened 3 months ago
It'd be great to be able to import (attach) DuckDB database files as well, similar to CSV, Parquet and Arrow files.
The code I'm currently using is basically this:
const loadDatabase = async (db: AsyncDuckDB, acceptedFile: File) => { try { const fileName = acceptedFile.name.replace(".duckdb", ""); // Connect to the database const cid = await db.connectInternal(); // Register the file await db.registerFileBuffer(fileName, new Uint8Array(await acceptedFile.arrayBuffer())); // Attach the database await db.runQuery(cid, `ATTACH '${fileName}' (READ_ONLY)`); // Disconnect from the database await db.disconnect(cid); } catch (err: any) { console.log(err); } }
It'd be great to be able to import (attach) DuckDB database files as well, similar to CSV, Parquet and Arrow files.
The code I'm currently using is basically this: