-
Notifications
You must be signed in to change notification settings - Fork 129
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
DuckDB support for read_json #1007
Comments
The error goes away if I upgrade the code that resolves this dependency version on |
Note that you should be able to use the latest prerelease version of DuckDB by saying: import * as duckdb from "npm:@duckdb/duckdb-wasm@next"; You can also initialize your npm cache to a specific version (an undocumented feature; you’ll need to restart the preview server after doing this): rm -rf docs/.observablehq/cache/_npm/@duckdb
mkdir docs/.observablehq/cache/_npm/@duckdb/duckdb-wasm@1.28.1-dev159.0 We should offer a more explicit way to change the default resolution in the project config. I’ll file an issue for that. I also filed duckdb/duckdb-wasm#1661 to track the current issue with DuckDB’s |
|
oh good to know, i just tried json and got very confused.
|
Just to be clear, JSON already works out of the box with 1.28.0: ---
sql:
foo: foo.json
---
```sql echo
SELECT * FROM foo
``` What doesn’t work is ```js echo
const db = await DuckDBClient.of();
const url = await FileAttachment("foo.json").url();
await db.query(`CREATE VIEW foo AS SELECT * FROM read_json('${url}', format = 'array', columns = {foo: 'UBIGINT', bar: 'VARCHAR'});`);
const sql = db.sql.bind(db);
```
```sql echo
SELECT * FROM foo
``` But you shouldn’t need |
Should we close this issue? We don't really have to support read_json. |
@mbostock - my use case is to use the |
Thanks @paulsm.
Meaning const db = await DuckDBClient.of({foo: fetch(url).then((r) => r.json())});
const sql = db.sql.bind(db); We’re also working on adding support for external URLs in the front matter (but that won’t help if your URL is dynamic). |
@mbostock - that's right: an external source, not an internal one, and one for which the |
The Observable Framework documentation explains how to use the
read_parquet
orread_csv
DuckDB functions to consume from endpoints that expose those data formats. It would be useful to extend this to support the DuckDB json extension'sread_json
function also, use of which currently fails with this error message:The text was updated successfully, but these errors were encountered: