File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -315,6 +315,18 @@ def into_view(self) -> TableProvider:
315315 :py:meth:`~datafusion.context.SessionContext.register_table`.
316316 ``datafusion.TableProvider.from_dataframe`` calls this method under the hood,
317317 and the older ``TableProvider.from_view`` helper is deprecated.
318+
319+ The ``DataFrame`` remains valid after conversion, so it can still be used for
320+ additional queries alongside the returned view.
321+
322+ Examples:
323+ >>> from datafusion import SessionContext
324+ >>> ctx = SessionContext()
325+ >>> df = ctx.sql("SELECT 1 AS value")
326+ >>> provider = df.into_view()
327+ >>> ctx.register_table("values_view", provider)
328+ >>> df.collect() # The DataFrame is still usable
329+ >>> ctx.sql("SELECT value FROM values_view").collect()
318330 """
319331 from datafusion .table_provider import TableProvider as _TableProvider
320332
You can’t perform that action at this time.
0 commit comments