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.

fix: the default rendering of ibis tables when interactive should still be lazy (#7163)

Myles Scolnick77fc7317e31f
diff --git a/marimo/_output/formatters/df_formatters.py b/marimo/_output/formatters/df_formatters.py
index f95a81ce4f..02432e45b2 100644
--- a/marimo/_output/formatters/df_formatters.py
+++ b/marimo/_output/formatters/df_formatters.py
@@ -335,8 +335,16 @@ class IbisFormatter(FormatterFactory):
mode = _get_display_mode(expr)
if mode == IbisDisplayMode.INTERACTIVE:
- return table(
- expr, selection=None, pagination=True
+ # Even though interactive mode is enabled and the expression may not be unbound,
+ # it could be an extremely large query (e.g. s3 bucket)
+ # Without lazy, this tries to load the entire dataframe into memory
+ #
+ # If a user does want the full dataframe, they can call .execute() manually
+ # or use `mo.ui.table(df)`
+ return table.lazy(
+ expr,
+ # Lazy, but preload the first page of data (since interactive is true)
+ preload=True,
)._mime_()
else:
return _format_lazy_expression(expr, mode)
diff --git a/marimo/_smoke_tests/formatters/ibis_opinionated_formatters.py b/marimo/_smoke_tests/formatters/ibis_opinionated_formatters.py
new file mode 100644
index 0000000000..dd12168738
--- /dev/null
+++ b/marimo/_smoke_tests/formatters/ibis_opinionated_formatters.py
@@ -0,0 +1,81 @@
+# /// script
+# requires-python = ">=3.13"
+# dependencies = [
+# "ibis-framework[duckdb]==11.0.0",
+# ]
+# ///
+
+import marimo
+
+__generated_with = "0.17.7"
+app = marimo.App(width="medium", auto_download=["html", "ipynb"])
+
+
+def _():
+ import ibis
+ import marimo as mo
+ return ibis, mo
+
+
+def _(ibis):
+ ibis.options.interactive = True
+
+ con = ibis.duckdb.connect()
+
+ con.raw_sql("INSTALL httpfs; LOAD httpfs;")
+
+ con.raw_sql("SET s3_region='us-west-2'")
+ return (con,)
+
+
+def _(con):
+ path = "s3://overturemaps-us-west-2/release/2025-10-22.0/theme=base/type=infrastructure/*.parquet"
+
+ t = con.read_parquet(path, hive_partitioning=True, filename=True)
+ return (t,)
+
+
+def _(t):
+ t.schema()
+ return
+
+
+def _(t):
+ t._find_backends()
+ return
+
+
+def _(t):
+ # This should render the opinionated table, somewhat fast, without fetching the full dataframe into memory
+ t
+ return
+
+
+def _(t):
+ # This should render the opinionated table, somewhat fast, without fetching the full dataframe into memory
+ t.limit(10)
+ return
+
+
+def _(mo, t):
+ # Should show a plain HTML table from ibis
+ mo.plain(t)
+ return
+
+
+def _():
+ # t
+ return
+
+
+if __name__ == "__main__":
+ app.run()
diff --git a/tests/_output/formatters/test_ibis_formatters.py b/tests/_output/formatters/test_ibis_formatters.py
index c739efba8a..126f449c2e 100644
--- a/tests/_output/formatters/test_ibis_formatters.py
+++ b/tests/_output/formatters/test_ibis_formatters.py
@@ -48,6 +48,9 @@ def test_ibis_formatters_interactive_mode(test_table) -> None:
mime, content = formatter(test_table)
assert mime == "text/html"
assert "<marimo-table" in content
+ assert (
+ "data-lazy='true'" in content
+ ) # Should be lazy in interactive mode
# Test column - should return table widget via as_table()
column = test_table.struct
@@ -56,6 +59,9 @@ def test_ibis_formatters_interactive_mode(test_table) -> None:
mime, content = formatter(column)
assert mime == "text/html"
assert "<marimo-table" in content
+ assert (
+ "data-lazy='true'" in content
+ ) # Should be lazy in interactive mode
# Test scalar - should return formatted text
scalar = test_table.floats.min()
@@ -87,6 +93,7 @@ def test_ibis_formatters_lazy_mode(test_table) -> None:
mime, content = formatter(test_table)
assert mime == "text/html"
assert "<marimo-tabs" in content
+ assert "<marimo-table" not in content # Should not be table widget
# Test column - should return Expression+SQL tabs
column = test_table.struct
@@ -95,6 +102,7 @@ def test_ibis_formatters_lazy_mode(test_table) -> None:
mime, content = formatter(column)
assert mime == "text/html"
assert "<marimo-tabs" in content
+ assert "<marimo-table" not in content # Should not be table widget
# Test scalar - should return Expression+SQL tabs
scalar = test_table.floats.min()
@@ -103,6 +111,7 @@ def test_ibis_formatters_lazy_mode(test_table) -> None:
mime, content = formatter(scalar)
assert mime == "text/html"
assert "<marimo-tabs" in content
+ assert "<marimo-table" not in content # Should not be table widget
finally:
ibis.options.interactive = original_interactive
@@ -136,6 +145,7 @@ def test_ibis_unbound_expressions() -> None:
mime, content = formatter(joined)
assert mime == "text/html"
assert "<marimo-tabs" in content
+ assert "<marimo-table" not in content # Should not be table widget
finally:
ibis.options.interactive = original_interactive
@@ -194,6 +204,7 @@ def test_ibis_polars_backend() -> None:
mime, content = formatter(polars_table)
assert mime == "text/html"
assert "<marimo-tabs" in content
+ assert "<marimo-table" not in content # Should not be table widget
finally:
ibis.options.interactive = original_interactive