Skip to content

Commit d9af482

Browse files
committed
feat: update register_dataset method to accept any __arrow_c_stream__ source
1 parent d02e0ae commit d9af482

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

python/datafusion/context.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import warnings
2323
from typing import TYPE_CHECKING, Any, Protocol
2424

25-
from datafusion.types import ensure_pyarrow_type
2625
from datafusion.common import DataTypeMap
26+
from datafusion.types import ensure_pyarrow_type
2727

2828
try:
2929
from warnings import deprecated # Python 3.13+
@@ -956,12 +956,16 @@ def register_avro(
956956
name, str(path), schema, file_extension, table_partition_cols
957957
)
958958

959-
def register_dataset(self, name: str, dataset: pa.dataset.Dataset) -> None:
960-
"""Register a :py:class:`pa.dataset.Dataset` as a table.
959+
def register_dataset(self, name: str, dataset: object) -> None:
960+
"""Register any ``__arrow_c_stream__`` source as a table.
961+
962+
Any Python object implementing the Arrow ``__arrow_c_stream__`` protocol
963+
can be registered, including objects from libraries such as nanoarrow,
964+
Polars, DuckDB, or :py:mod:`pyarrow.dataset`.
961965
962966
Args:
963967
name: Name of the table to register.
964-
dataset: PyArrow dataset.
968+
dataset: Object exposing ``__arrow_c_stream__``.
965969
"""
966970
self.ctx.register_dataset(name, dataset)
967971

0 commit comments

Comments
 (0)