Skip to content

fix(duckdb): use to_arrow_table() instead of deprecated fetch_arrow_table()#1

Merged
johannesboyne merged 1 commit into
mainfrom
fix/duckdb-to-arrow-table
Jun 9, 2026
Merged

fix(duckdb): use to_arrow_table() instead of deprecated fetch_arrow_table()#1
johannesboyne merged 1 commit into
mainfrom
fix/duckdb-to-arrow-table

Conversation

@johannesboyne

@johannesboyne johannesboyne commented Jun 9, 2026

Copy link
Copy Markdown
Member

What

Route the five DuckDB-backend arrow extractions (get_schema, list_catalogs, list_databases, _metadata, _get_schema_using_query) through a small _to_pyarrow_table() helper.

Why

DuckDB 1.5 deprecated DuckDBPyRelation/DuckDBPyConnection.fetch_arrow_table() in favour of to_arrow_table(), emitting a DeprecationWarning on every call (this floods the dq-platform qserviceworker logs).

A plain rename to to_arrow_table() is not safe: ibis supports duckdb>=0.10.3, and on those older versions to_arrow_table does not exist on the connection/cursor object — a rename produces 218 backend test failures (AttributeError: 'DuckDBPyConnection' object has no attribute 'to_arrow_table').

The helper prefers to_arrow_table() when present (new duckdb → no warning) and falls back to fetch_arrow_table() otherwise (old duckdb → still works, not yet deprecated there):

def _to_pyarrow_table(result):
    to_arrow_table = getattr(result, "to_arrow_table", None)
    if to_arrow_table is not None:
        return to_arrow_table()
    return result.fetch_arrow_table()

Notes

  • Return type (pyarrow.Table) and all downstream usage unchanged; verified both helper branches and that the DeprecationWarning is gone on duckdb 1.5.1.
  • Branched off the 12.0.0 release commit (01e429b) that dq-platform pins, so it carries no unrelated changes.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the duckdb label Jun 9, 2026
DuckDB 1.5 deprecated DuckDBPyRelation/DuckDBPyConnection.fetch_arrow_table()
in favor of to_arrow_table() and emits a DeprecationWarning on every call.
The DuckDB backend used the old name in five spots (get_schema,
list_catalogs, list_databases, _metadata, _get_schema_using_query).

Route all five through a small _to_pyarrow_table() helper that prefers
to_arrow_table() when available and falls back to fetch_arrow_table() for
the older duckdb versions ibis still supports (duckdb>=0.10.3), where
to_arrow_table is not yet defined on the connection/cursor object. A plain
rename breaks those versions (218 backend test failures in CI).

Return type (pyarrow.Table) and all downstream usage are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@johannesboyne johannesboyne force-pushed the fix/duckdb-to-arrow-table branch from 2a5622f to 0f20c9c Compare June 9, 2026 09:20
@johannesboyne johannesboyne merged commit 6c27c0a into main Jun 9, 2026
83 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant