ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
5.33k stars 599 forks source link

feat: add method to_json() (at least for duckdb backend) #10413

Open cboettig opened 3 weeks ago

cboettig commented 3 weeks ago

Is your feature request related to a problem?

No response

What is the motivation behind your request?

No response

Describe the solution you'd like

Duckdb supports https://duckdb.org/docs/guides/file_formats/json_export.html, including support for JSON line format or ARRAY format.

native export methods are particularly handy since they can stream data too big for RAM, and can easily stream to remote sources like S3 buckets. It would be great to see this included among the other .to_* methods supported by duckdb.

I could take a go at a PR perhaps if you gave me a few pointers? but might be faster to roll this without me.

What version of ibis are you running?

9.5.0

What backend(s) are you using, if any?

DuckDB

Code of Conduct

cpcloud commented 2 weeks ago

This seems entirely reasonable. Not sure what other backends support writing JSON, but it's valuable enough for DuckDB and generically useful enough to have it available as an API IMO.