@@ -50,8 +50,10 @@ A complete example can be found in the `examples folder <https://github.com/apac
5050 Once you have this library available, you can construct a
5151:py:class: `~datafusion.TableProvider ` in Python and register it with the
5252``SessionContext ``. Table providers can be created either from the PyCapsule exposed by
53- your Rust provider or from an existing :py:class: `~datafusion.dataframe.DataFrame `
54- using ``TableProvider.from_view() ``.
53+ your Rust provider or from an existing :py:class: `~datafusion.dataframe.DataFrame `.
54+ Call the provider's ``__datafusion_table_provider__() `` method to obtain the capsule
55+ before constructing a ``TableProvider ``. The ``TableProvider.from_view() `` helper is
56+ deprecated; instead use ``TableProvider.from_dataframe() `` or ``DataFrame.into_view() ``.
5557
5658.. code-block :: python
5759
@@ -60,16 +62,18 @@ using ``TableProvider.from_view()``.
6062 ctx = SessionContext()
6163 provider = MyTableProvider()
6264
63- capsule_provider = TableProvider.from_capsule(provider)
65+ capsule = provider.__datafusion_table_provider__()
66+ capsule_provider = TableProvider.from_capsule(capsule)
6467
6568 df = ctx.from_pydict({" a" : [1 ]})
66- view_provider = TableProvider.from_view(df)
69+ view_provider = TableProvider.from_dataframe(df)
70+ # or: view_provider = df.into_view()
6771
6872 ctx.register_table(" capsule_table" , capsule_provider)
6973 ctx.register_table(" view_table" , view_provider)
7074
7175 ctx.table(" capsule_table" ).show()
7276 ctx.table(" view_table" ).show()
7377
74- Both ``TableProvider.from_capsule() `` and ``TableProvider.from_view () `` create
78+ Both ``TableProvider.from_capsule() `` and ``TableProvider.from_dataframe () `` create
7579table providers that can be registered with the SessionContext using ``register_table() ``.
0 commit comments