From 12d1be61fbfcaddba769d54e74c22aba4c887e5d Mon Sep 17 00:00:00 2001 From: Florian Valeye Date: Mon, 5 Oct 2026 12:40:38 +0200 Subject: [PATCH 1/3] docs(marimo): add a reactive lakehouse notebook --- .gitignore | 1 + README.md | 11 ++++++++ examples/marimo_notebook.py | 51 +++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 examples/marimo_notebook.py diff --git a/.gitignore b/.gitignore index ad4a1f1..c99e3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,7 @@ target/ # Jupyter Notebook .ipynb_checkpoints +__marimo__/ # IPython profile_default/ diff --git a/README.md b/README.md index 0eda484..ee29594 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,17 @@ con.disconnect() `database` means schema. Queries run remotely; results are buffered in memory. Writes use the SDK directly. See the [runnable example](examples/ibis_queries.py). +### marimo + +Use the Ibis connection with `mo.sql(query, engine=con)`. Try the +[notebook](examples/marimo_notebook.py) with `ALTERTABLE_USERNAME` and +`ALTERTABLE_PASSWORD` set: + +```bash +pip install -e '.[ibis]' marimo +marimo edit examples/marimo_notebook.py +``` + ## Usage ### Initialization diff --git a/examples/marimo_notebook.py b/examples/marimo_notebook.py new file mode 100644 index 0000000..6711638 --- /dev/null +++ b/examples/marimo_notebook.py @@ -0,0 +1,51 @@ +import marimo + +__generated_with = "0.25.1" +app = marimo.App(width="medium", sql_output="pandas") + + +@app.cell +def _(): + import os + + import ibis + import marimo as mo + + return ibis, mo, os + + +@app.cell +def _(ibis, os): + connection = ibis.altertable.connect( + base_url=os.environ.get("ALTERTABLE_BASE_URL", "https://api.altertable.ai") + ) + return (connection,) + + +@app.cell +def _(mo): + minimum = mo.ui.slider(0, 40, value=10, label="Minimum customer total") + minimum + return (minimum,) + + +@app.cell +def _(connection, minimum, mo): + totals = mo.sql( + f""" + WITH orders(customer, amount) AS ( + VALUES ('alice', 10), ('alice', 20), ('bob', 5) + ) + SELECT customer, sum(amount) AS total + FROM orders + GROUP BY customer + HAVING sum(amount) >= {minimum.value} + ORDER BY customer + """, + engine=connection, + ) + return (totals,) + + +if __name__ == "__main__": + app.run() From b4fab3d4824558e9da0613033e84fb4dd74d853b Mon Sep 17 00:00:00 2001 From: Florian Valeye Date: Mon, 5 Oct 2026 15:30:20 +0200 Subject: [PATCH 2/3] docs(marimo): debounce queries and guide table discovery --- README.md | 2 ++ examples/marimo_notebook.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee29594..7df9b34 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ pip install -e '.[ibis]' marimo marimo edit examples/marimo_notebook.py ``` +Use marimo's Datasources panel to add SQL cells for your own tables. + ## Usage ### Initialization diff --git a/examples/marimo_notebook.py b/examples/marimo_notebook.py index 6711638..65bfff5 100644 --- a/examples/marimo_notebook.py +++ b/examples/marimo_notebook.py @@ -24,7 +24,9 @@ def _(ibis, os): @app.cell def _(mo): - minimum = mo.ui.slider(0, 40, value=10, label="Minimum customer total") + minimum = mo.ui.slider( + 0, 40, value=10, label="Minimum customer total", debounce=True, show_value=True + ) minimum return (minimum,) From 506d6df1cd0bf09911f23b1629ace987300f15eb Mon Sep 17 00:00:00 2001 From: Florian Valeye Date: Mon, 5 Oct 2026 16:09:07 +0200 Subject: [PATCH 3/3] Address feedback: use the default API URL --- examples/marimo_notebook.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/examples/marimo_notebook.py b/examples/marimo_notebook.py index 65bfff5..5e35d62 100644 --- a/examples/marimo_notebook.py +++ b/examples/marimo_notebook.py @@ -6,19 +6,15 @@ @app.cell def _(): - import os - import ibis import marimo as mo - return ibis, mo, os + return ibis, mo @app.cell -def _(ibis, os): - connection = ibis.altertable.connect( - base_url=os.environ.get("ALTERTABLE_BASE_URL", "https://api.altertable.ai") - ) +def _(ibis): + connection = ibis.altertable.connect() return (connection,)