duckdb / duckdb/duckdb-node

Named parameters, how?

Open
#109 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
91
Forks
36
PR merge metrics
No merged PRs in 30d

Description

Hi,

![image](https://github.com/user-attachments/assets/1bc69db2-6147-4ffc-b2ea-fc342322bdb2)

I was following this video (https://www.youtube.com/watch?v=U6k7HnQiWzc) and tried to do the same in js.
While the nodejs [API](https://duckdb.org/docs/api/nodejs/reference) has `...params` for nearly every function, it seems like named paramaters isn't a thing on the js side?

I couldn't get it working.
For example:
```
const result = await db.run(`SELECT a, b, array_cosine_similarity(
embedding, $searchVector::FLOAT[1024]) as score FROM x ORDER BY score DESC LIMIT $limit`, {"searchVector": await embeddingContext.getEmbeddingFor("test"), "limit": 10});
console.log(result);
```

Returns:
```
[Error: Invalid Input Error: Values were not provided for the following prepared statement parameters: limit, searchVector] {
errno: -1,
code: 'DUCKDB_NODEJS_ERROR',
errorType: 'Invalid Input'
}
```

It should be on par with what python does yet it is just not working. It is not implemented for the js side of things?

Sidenote, i'm running [duckdb-async](https://github.com/motherduckdb/duckdb-async) but it wraps this library so errors there probably originate here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.