ibis icon indicating copy to clipboard operation
ibis copied to clipboard

feat: Implement Arrow PyCapsule Interface for data import, schema

Open kylebarron opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?

This is a follow up to a previous feature request (https://github.com/ibis-project/ibis/issues/9140). That added export via the PyCapsule interface but I think there's also further gains from being able to import via the PyCapsule interface as well.

Additionally, the ibis schema is presumably Arrow or arrow-compatible under the hood? It would be great to implement the PyCapsule Interface on the schema object as well.

What is the motivation behind your request?

Easier interoperability between Ibis and other Python Arrow-based libraries.

Describe the solution you'd like

I'm not sure how ibis works under the hood and whether there's an easy API for Arrow import that's already in Python? I see there's a read_parquet method but is that pushed down to relevant implementations?

What version of ibis are you running?

Latest

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

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

kylebarron avatar Jul 22 '24 17:07 kylebarron

Additionally, the ibis schema is presumably Arrow or arrow-compatible under the hood? It would be great to implement the PyCapsule Interface on the schema object as well.

This is definitely doable, can push up a PR momentarily.

I think there's also further gains from being able to import via the PyCapsule interface as well.

I'm not sure what you're exactly asking for here. Are you asking for a way to create an ibis.Table from something exposing an __arrow_c_stream__ interface (fairly easy)? Or from the capsule object itself? Or something else?

jcrist avatar Jul 22 '24 18:07 jcrist

I'm not sure what you're exactly asking for here. Are you asking for a way to create an ibis.Table from something exposing an __arrow_c_stream__ interface (fairly easy)?

Yes, that's all!

kylebarron avatar Jul 22 '24 18:07 kylebarron

Got it, thanks! I'll push up a PR adding both ASAP.

jcrist avatar Jul 22 '24 19:07 jcrist