Skip to content

Commit 40a30c1

Browse files
authored
docs(examples): add unbind example (#10454)
1 parent ae1bb20 commit 40a30c1

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ibis/expr/types/core.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,26 @@ def to_torch(
733733
)
734734

735735
def unbind(self) -> ir.Table:
736-
"""Return an expression built on `UnboundTable` instead of backend-specific objects."""
736+
"""Return an expression built on `UnboundTable` instead of backend-specific objects.
737+
738+
Examples
739+
--------
740+
>>> import ibis
741+
>>> import pandas as pd
742+
>>> duckdb_con = ibis.duckdb.connect()
743+
>>> polars_con = ibis.polars.connect()
744+
>>> for backend in (duckdb_con, polars_con):
745+
... t = backend.create_table("t", pd.DataFrame({"a": [1, 2, 3]}))
746+
>>> bound_table = duckdb_con.table("t")
747+
>>> bound_table.get_backend().name
748+
'duckdb'
749+
>>> unbound_table = bound_table.unbind()
750+
>>> polars_con.execute(unbound_table)
751+
a
752+
0 1
753+
1 2
754+
2 3
755+
"""
737756
from ibis.expr.rewrites import _, d, p
738757

739758
rule = p.DatabaseTable >> d.UnboundTable(

0 commit comments

Comments
 (0)