Skip to content

Commit 4b34a61

Browse files
authored
feat: add get_backend to expr (#10228)
1 parent df08d5e commit 4b34a61

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ibis/backends/tests/test_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,8 @@ def test_unbind(alltypes, expr_fn):
136136

137137
assert "Unbound" not in repr(expr)
138138
assert "Unbound" in repr(expr.unbind())
139+
140+
141+
def test_get_backend(con, alltypes):
142+
assert alltypes.get_backend() is con
143+
assert alltypes.id.min().get_backend() is con

ibis/expr/types/core.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,17 @@ def _find_backend(self, *, use_default: bool = False) -> BaseBackend:
375375

376376
return backends[0]
377377

378+
def get_backend(self):
379+
"""Get the current Ibis backend of the expression.
380+
381+
Returns
382+
-------
383+
BaseBackend
384+
The Ibis backend.
385+
386+
"""
387+
return self._find_backend(use_default=True)
388+
378389
def execute(
379390
self,
380391
limit: int | str | None = "default",

0 commit comments

Comments
 (0)