-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Using DuckDB with Deno #23656
Comments
This is because we currently don't support "lifecycle hooks" when installing npm dependencies (eg. You can work around this for now if you use "bring your own node modules" - by installing using |
Thank you! |
Hi @nshiab , have you succeeded? I tried but I got this error:
My data/index.ts contains:
The steps are:
By adding
And by adding
Have you managed to use duckdb in Deno? Best |
--Update-- I've upgraded to deno 1.43.1 (was 1.40.4), and now I get this error:
Do you have any idea? |
Hi @MaximePawlakFr! For now, I am using node/npm. But @bartlomieju is working on it #23558. |
It's an internal bug in Deno, but it seems easy enough to fix it to make example from DuckDB's page work. I'll try to have it done tonight. |
I merged a fix that makes DuckDB work. It should be available in canary in ~2h - you can then use |
Thank you Bartek. I've just updated deno to I tried again. I can load duckdb without the previous error. But I can not run any request to duckdb. I get a Here is my code: import duckdb from "duckdb";
const db = new duckdb.Database(":memory:");
console.log(db);
Deno.serve(async (req) => {
const request =
"SELECT * FROM 'https://shell.duckdb.org/data/tpch/0_01/parquet/orders.parquet' LIMIT 1000;";
console.log(request);
const result = await new Promise((resolve, reject) => {
db.all(request, function (err, res) {
console.log(res);
if (err) {
console.warn(err);
reject(err);
}
resolve(res);
});
});
const res = JSON.stringify(
result,
(key, value) => typeof value === "bigint" ? value.toString() : value, // return everything else unchanged
);
return new Response(
res,
{
headers: { "Content-Type": "application/json" },
},
);
}); I run I see in my terminal:
It looks like something went wrong with duckdb. Any idea what? Regards |
So far I'm not able to reproduce this segmentation fault on my end - I get results as expected. Can you update once again to latest canary and try again? |
Unfortunately, I am on a M1 Mac, so I can't install canary versions, from what I gathered. |
@nshiab you can, we've been shipping canary version for ARM Macs for a couple months now :) |
@bartlomieju What am I doing wrong? 😢 Thank you so much for your help! |
It appears that |
@nshiab the problem with |
@nshiab you need to specify
|
IT WORKS! Amazing! Thanks for your patience @bartlomieju! But... if I actually run a query, it fails. This is an example from the duckdb repo. |
Thanks! I don't get a segfault, but I'm getting a panic like so: import duckdb from "duckdb";
const db = new duckdb.Database(":memory:");
const con = db.connect();
con.all("SELECT 42 AS fortytwo", function (err, res) {
if (err) {
console.warn(err);
}
console.log(res[0].fortytwo);
})
I'll try to debug this one as well. |
I've just update to the last canary: Keep me in the loop if you make any advance. Thanks a lot for what you tried. |
Version: Deno 1.41.3
Hi!
I tried to use duckdb-node with Deno by running this
index.ts
.But when running
deno run -A index.ts
, I get this error:Is it possible to use DuckDB with Deno?
Thank you very much for your great work.
The text was updated successfully, but these errors were encountered: