Skip to content

Commit

Permalink
docs(examples): add unbind example (#10454)
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek authored Nov 10, 2024
1 parent ae1bb20 commit 40a30c1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ibis/expr/types/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,26 @@ def to_torch(
)

def unbind(self) -> ir.Table:
"""Return an expression built on `UnboundTable` instead of backend-specific objects."""
"""Return an expression built on `UnboundTable` instead of backend-specific objects.
Examples
--------
>>> import ibis
>>> import pandas as pd
>>> duckdb_con = ibis.duckdb.connect()
>>> polars_con = ibis.polars.connect()
>>> for backend in (duckdb_con, polars_con):
... t = backend.create_table("t", pd.DataFrame({"a": [1, 2, 3]}))
>>> bound_table = duckdb_con.table("t")
>>> bound_table.get_backend().name
'duckdb'
>>> unbound_table = bound_table.unbind()
>>> polars_con.execute(unbound_table)
a
0 1
1 2
2 3
"""
from ibis.expr.rewrites import _, d, p

rule = p.DatabaseTable >> d.UnboundTable(
Expand Down

0 comments on commit 40a30c1

Please sign in to comment.