From 40a30c11e181f3fc5c82ce65f63c6d48b3ceeae9 Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Sun, 10 Nov 2024 07:25:26 -0500 Subject: [PATCH] docs(examples): add unbind example (#10454) --- ibis/expr/types/core.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ibis/expr/types/core.py b/ibis/expr/types/core.py index 2da8edb2879f..d2d73028f833 100644 --- a/ibis/expr/types/core.py +++ b/ibis/expr/types/core.py @@ -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(