Skip to content

DuckDBPyConnection object has no attribute 'to_arrow_table' #97

@paultiq

Description

@paultiq

What happens?

There's an inconsistency between DuckDBPyConnection and DuckDBPyRelation:

Relations expose to_arrow_table, but not Connections.

Noticed this when fixing some broken code paths due to the change to .arrow().

To Reproduce

import duckdb

print(duckdb.__version__)
with duckdb.connect() as conn:
    t1 = conn.sql("select * from range(10)").fetch_arrow_table()
    print("sql fetch_arrow_table works")
    t2 = conn.sql("select * from range(10)").to_arrow_table()
    print("sql to_arrow_table works")
    t3 = conn.execute("select * from range(10)").fetch_arrow_table()
    print("execute fetch_arrow_table works")
    t4 = conn.execute("select * from range(10)").to_arrow_table()
    print("execute to_arrow_table works")

1.5.0.dev44
sql fetch_arrow_table works
sql to_arrow_table works
execute fetch_arrow_table works

AttributeError Traceback (most recent call last)
Cell In[1], line 4
1 import duckdb
3 print(duckdb.version)
----> 4 with duckdb.connect() as conn:
5 t1 = conn.sql("select * from range(10)").fetch_arrow_table()
6 print("sql fetch_arrow_table works")

Cell In[1], line 11
9 t3 = conn.execute("select * from range(10)").fetch_arrow_table()
10 print("execute fetch_arrow_table works")
---> 11 t4 = conn.execute("select * from range(10)").to_arrow_table()
12 print("execute to_arrow_table works")

AttributeError: '_duckdb.DuckDBPyConnection' object has no attribute 'to_arrow_table'

OS:

Linux

DuckDB Package Version:

1.4.0, duckdb==1.5.0.dev44

Python Version:

3.11

Full Name:

Paul T

Affiliation:

Iqmo

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a nightly build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions