Skip to content

Commit 29203c6

Browse files
committed
docs: enhance docstring for DataFrame.into_view method to clarify usage and advantages
1 parent d4ff136 commit 29203c6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

python/datafusion/dataframe.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,17 @@ def into_view(self) -> TableProvider:
319319
"""Convert ``DataFrame`` into a ``TableProvider`` view for registration.
320320
321321
This is the preferred way to obtain a view for
322-
:py:meth:`~datafusion.context.SessionContext.register_table`.
322+
:py:meth:`~datafusion.context.SessionContext.register_table` for several reasons:
323+
324+
1. **Direct API**: Most efficient path - directly calls the underlying Rust
325+
``DataFrame.into_view()`` method without intermediate delegations.
326+
2. **Clear semantics**: The ``into_`` prefix follows Rust conventions,
327+
indicating conversion from one type to another.
328+
3. **Canonical method**: Other approaches like ``TableProvider.from_dataframe``
329+
delegate to this method internally, making this the single source of truth.
330+
4. **Deprecated alternatives**: The older ``TableProvider.from_view`` helper
331+
is deprecated and issues warnings when used.
332+
323333
``datafusion.TableProvider.from_dataframe`` calls this method under the hood,
324334
and the older ``TableProvider.from_view`` helper is deprecated.
325335

0 commit comments

Comments
 (0)