-
I use the DuckDB to create SQL tables from JSON documents that I pull from a service. Right now I have to create temporary JSON files to import the data into DuckDB. Here is an example query one might use:
But it seems a little bit cumbersome to create temporary JSON files when the json string itself or a stream of the json string can be provided. While looking into a solution I came across a discussion on official DuckDB github page that asks the same question and it seems the official Python api of DuckDB allows feeding streams directly into read_json function. Is there a way to achieve the same with DuckDB.NET? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The discussion you linked to says that (emphasis mine):
There is no C API to influence how What you could do as a workaround, is to create a user-defined table function that will take a json string and convert it in the table to create a function that will fetch the json and return it as a table. For example, something like this:
|
Beta Was this translation helpful? Give feedback.
The discussion you linked to says that (emphasis mine):
There is no C API to influence how
read_json_auto
works so there is nothing I can do about it.What you could do as a workaround, is to create a user-defined table function that will take a json string and convert it in the table to create a function that will fetch the json and return it as a table. For example, something like this:
CREATE TABLE x AS SELECT * FROM read_json_from_some_service(service_param1, service_param2, ... service_param_n)