Skip to content

Commit

Permalink
chore: Backport #3102 to web (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
prql-bot committed Jul 26, 2023
1 parent c8d15dd commit 9149606
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions web/playground/src/workbench/duckdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,24 @@ export const CHINOOK_TABLES = [
];

async function registerChinook(db) {
const baseUrl = `${window.location.href}data/chinook`;
const baseUrl = `${window.location.href}/data/chinook`;

await Promise.all(
CHINOOK_TABLES.map(async (table) => {
const res = await fetch(`${baseUrl}/${table}.csv`);
const text = await res.text();

db.registerFileText(`${table}.csv`, res);
db.registerFileText(`${table}.csv`, text);
}),
);

const c = await db.connect();
for (const table of CHINOOK_TABLES) {
await c.insertCSVFromPath(`${table}.csv`, { name: table, detect: true });
await c.insertCSVFromPath(`${table}.csv`, {
name: table,
detect: true,
header: true,
});
}
c.close();
}

0 comments on commit 9149606

Please sign in to comment.