Skip to content
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

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

Open
1 task done
cboettig opened this issue Nov 1, 2024 · 3 comments
Open
1 task done

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

cboettig opened this issue Nov 1, 2024 · 3 comments
Labels
duckdb The DuckDB backend feature Features or general enhancements

Comments

@cboettig
Copy link

cboettig commented Nov 1, 2024

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

  • I agree to follow this project's Code of Conduct
@cboettig cboettig added the feature Features or general enhancements label Nov 1, 2024
@cpcloud
Copy link
Member

cpcloud commented Nov 3, 2024

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.

@cpcloud cpcloud added the duckdb The DuckDB backend label Nov 3, 2024
@cpcloud cpcloud added this to the 10.0 milestone Nov 3, 2024
@cpcloud
Copy link
Member

cpcloud commented Dec 30, 2024

Since this is a feature addition, I'm going to remove it from the 10.0 milestone in the interest of trying to get a release out in January 2025.

@cpcloud cpcloud removed this from the 10.0 milestone Dec 30, 2024
@cboettig
Copy link
Author

cboettig commented Jan 2, 2025

sounds good. Just noting the my current work-around to this (because somehow I always forget this)

expr = con.read_parquet(...).filter(...)
query = ibis.to_sql(expr)
con.raw_sql(f"COPY ({query}) TO 's3://{bucket}/{path}/example.json' (FORMAT JSON, ARRAY true);")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duckdb The DuckDB backend feature Features or general enhancements
Projects
Status: backlog
Development

No branches or pull requests

2 participants