Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Ibis Deferred expression object will not be handeled as datasource (#7801)

szst11be3174b07113
diff --git a/marimo/_sql/get_engines.py b/marimo/_sql/get_engines.py
index 7ddcdb23e9..586cf456c9 100644
--- a/marimo/_sql/get_engines.py
+++ b/marimo/_sql/get_engines.py
@@ -51,6 +51,12 @@ def get_engines_from_variables(
engines: list[tuple[VariableName, BaseEngine[Any]]] = []
for variable_name, value in variables:
+ # Ibis Deferred expression object should not be handled as datasource #7791
+ var_type = type(value)
+ var_type_name = f"{var_type.__module__}.{var_type.__qualname__}"
+ if var_type_name == "ibis.common.deferred.Deferred":
+ continue
+
for sql_engine in SUPPORTED_ENGINES:
if sql_engine.is_compatible(value):
engines.append(
diff --git a/tests/_sql/test_get_engines.py b/tests/_sql/test_get_engines.py
index 2feb0ae292..62c580d0e2 100644
--- a/tests/_sql/test_get_engines.py
+++ b/tests/_sql/test_get_engines.py
@@ -32,6 +32,7 @@ HAS_DUCKDB = DependencyManager.duckdb.has()
HAS_CLICKHOUSE = DependencyManager.chdb.has()
HAS_REDSHIFT = DependencyManager.redshift_connector.has()
HAS_PYARROW = DependencyManager.pyarrow.has()
+HAS_IBIS = DependencyManager.ibis.has()
@pytest.mark.skipif(not HAS_SQLALCHEMY, reason="SQLAlchemy not installed")
@@ -459,3 +460,17 @@ def test_get_engines_clickhouse() -> None:
# assert connection.default_database == "default"
# assert connection.default_schema == "default"
assert connection.databases == []
+
+
+ not HAS_IBIS,
+ reason="Ibis not installed",
+)
+def test_variables_without_datasource_engine() -> None:
+ # Ibis Deferred expression object should not be handled as a datasource engine #7791
+ import ibis
+
+ deferred_for_test = ibis._["a"]
+ variables = [("deferred_for_test", deferred_for_test)]
+ engines = get_engines_from_variables(variables)
+ assert not engines