Skip to content

Commit 5011915

Browse files
committed
Make the marimo example runnable without tpch-specific setup.
Use a portable default query and return rendered UI/results so the single documented example works out of the box.
1 parent 847663f commit 5011915

2 files changed

Lines changed: 7 additions & 21 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ Keep the editor in one cell and consume `editor.result` in another. The editor c
4545

4646
Marimo only shows **what you `return` from a cell**. Calling `mo.vstack(...)` or `hm.query_result(...)` without returning it produces no visible output.
4747

48-
See `examples/hotdata_basic.py` for a full notebook: five Python cells (`mo.vstack` for **controls only**, then a separate cell `return hm.query_result(editor.result)` so results show immediately — **avoid** `mo.lazy` here: it only renders after the block scrolls into view, which looks like an empty cell). If Marimo shows **empty cells**, quit and remove `examples/__marimo__/` so the UI reloads from the `.py` file only.
48+
See `examples/hotdata_basic.py` for a full runnable notebook flow.
4949

5050
## Examples
5151

52-
- `examples/hotdata_basic.py` — end-to-end editor + browser + result rendering flow.
52+
- `examples/hotdata_basic.py` — end-to-end browser + editor + result rendering flow.
5353

5454
Run:
5555

5656
```bash
57-
marimo edit examples/hotdata_basic.py --no-token
57+
uv run marimo edit examples/hotdata_basic.py --no-token
5858
```
5959

6060
## Layout

examples/hotdata_basic.py

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,17 @@ def _(hm, mo, os):
3333

3434
@app.cell
3535
def _(client, hm, mo):
36-
id_map = client.connection_id_by_name()
37-
tpch_id = id_map.get("tpch")
38-
mo.stop(
39-
not tpch_id,
40-
mo.callout(
41-
mo.md(
42-
"This example expects a connection named **tpch**. "
43-
"Create it in Hotdata or adjust the name in the notebook."
44-
),
45-
kind="warn",
46-
),
47-
)
48-
browser = hm.table_browser(client, connection_id=tpch_id)
36+
browser = hm.table_browser(client)
4937
editor = hm.sql_editor(
5038
client,
51-
default_sql="SELECT * FROM tpch.tpch_sf1.nation LIMIT 5",
39+
default_sql="SELECT 1 AS ok",
5240
)
5341
return browser, editor
5442

5543

5644
@app.cell
5745
def _(browser, editor, mo):
58-
mo.vstack([browser.ui, editor.ui], gap=2)
59-
return
46+
return mo.vstack([browser.ui, editor.ui], gap=2)
6047

6148

6249
@app.cell
@@ -65,8 +52,7 @@ def _(editor, hm):
6552
_run = editor.run.value
6653
_rerun = editor.rerun.value
6754
_clear = editor.clear.value
68-
hm.query_result(editor.result)
69-
return _clear, _rerun, _run
55+
return hm.query_result(editor.result), _clear, _rerun, _run
7056

7157

7258
if __name__ == "__main__":

0 commit comments

Comments
 (0)