Skip to content

Commit 4d99018

Browse files
IndexSeekcpcloud
andauthored
docs(examples): add ibis.get_backend examples (#10489)
Co-authored-by: Phillip Cloud <[email protected]>
1 parent 161c61f commit 4d99018

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ibis/expr/api.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,6 +1734,8 @@ def set_backend(backend: str | BaseBackend) -> None:
17341734
def get_backend(expr: Expr | None = None) -> BaseBackend:
17351735
"""Get the current Ibis backend to use for a given expression.
17361736
1737+
Parameters
1738+
----------
17371739
expr
17381740
An expression to get the backend from. If not passed, the default
17391741
backend is returned.
@@ -1743,6 +1745,25 @@ def get_backend(expr: Expr | None = None) -> BaseBackend:
17431745
BaseBackend
17441746
The Ibis backend.
17451747
1748+
Examples
1749+
--------
1750+
>>> import ibis
1751+
1752+
Get the default backend.
1753+
1754+
>>> ibis.get_backend() # doctest: +ELLIPSIS
1755+
<ibis.backends.duckdb.Backend object at 0x...>
1756+
1757+
Get the backend for a specific expression.
1758+
1759+
>>> polars_con = ibis.polars.connect()
1760+
>>> t = polars_con.create_table("t", ibis.memtable({"a": [1, 2, 3]}))
1761+
>>> ibis.get_backend(t) # doctest: +ELLIPSIS
1762+
<ibis.backends.polars.Backend object at 0x...>
1763+
1764+
See Also
1765+
--------
1766+
[`get_backend()`](./expression-tables.qmd#ibis.expr.types.relations.Table.get_backend)
17461767
"""
17471768
if expr is None:
17481769
from ibis.config import _default_backend

0 commit comments

Comments
 (0)