Skip to content

Commit 2183373

Browse files
committed
Expand the marimo example into a multi-widget demo.
Show workspace selection, connection status, table browsing, SQL execution, run history, and recent-result loading in one runnable notebook.
1 parent 5011915 commit 2183373

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

examples/hotdata_basic.py

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,41 @@ def _(hm, mo, os):
2727
kind="warn",
2828
),
2929
)
30-
client = hm.from_env()
31-
return (client,)
30+
workspace = hm.workspace_selector_from_env()
31+
return (workspace,)
3232

3333

3434
@app.cell
35-
def _(client, hm, mo):
35+
def _(hm, workspace):
36+
client = workspace.client
37+
status = hm.connection_status(client)
3638
browser = hm.table_browser(client)
3739
editor = hm.sql_editor(
3840
client,
3941
default_sql="SELECT 1 AS ok",
4042
)
41-
return browser, editor
43+
recent = hm.recent_results(client, limit=20)
44+
history = hm.run_history(client, limit=10)
45+
return browser, editor, history, recent, status, workspace
4246

4347

4448
@app.cell
45-
def _(browser, editor, mo):
46-
return mo.vstack([browser.ui, editor.ui], gap=2)
49+
def _(browser, editor, mo, recent, status, workspace):
50+
return mo.vstack(
51+
[
52+
workspace.ui,
53+
status,
54+
browser.ui,
55+
editor.ui,
56+
recent.ui,
57+
],
58+
gap=2,
59+
)
60+
61+
62+
@app.cell
63+
def _(history):
64+
return history
4765

4866

4967
@app.cell
@@ -55,5 +73,11 @@ def _(editor, hm):
5573
return hm.query_result(editor.result), _clear, _rerun, _run
5674

5775

76+
@app.cell
77+
def _(hm, recent):
78+
_selected = recent.pick.value
79+
return hm.query_result(recent.result, label="Recent result"), _selected
80+
81+
5882
if __name__ == "__main__":
5983
app.run()

0 commit comments

Comments
 (0)