Skip to content

Commit c494a18

Browse files
committed
fix: show SQL and recent query results in demo tabs
Wire editor.result and recent.result into dedicated cells and stack them below the SQL editor and recent-results pickers inside each tab.
1 parent 0a11268 commit c494a18

1 file changed

Lines changed: 33 additions & 15 deletions

File tree

examples/demo.py

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,48 @@ def _(browser):
7171

7272

7373
@app.cell
74-
def _(browser_ui, editor, history, mo, recent, status, workspace):
75-
mo.ui.tabs({
76-
"Workspaces": workspace.ui,
77-
"Connections": status,
78-
"Datasets": browser_ui,
79-
"SQL query": editor.ui,
80-
"Recent results": recent.ui,
81-
"Run history": history,
82-
})
83-
return
74+
def _(editor):
75+
editor_ui = editor.ui
76+
return (editor_ui,)
8477

8578

8679
@app.cell
87-
def _(editor):
88-
# Explicitly touch nested widget values so Marimo reruns this cell on clicks.
80+
def _(editor, hm):
8981
_run = editor.run.value
9082
_rerun = editor.rerun.value
9183
_clear = editor.clear.value
92-
return
84+
sql_result = hm.query_result(editor.result)
85+
return (sql_result,)
86+
87+
88+
@app.cell
89+
def _(editor_ui, mo, sql_result):
90+
sql_tab = mo.vstack([editor_ui, sql_result], gap=2)
91+
return (sql_tab,)
9392

9493

9594
@app.cell
96-
def _(recent):
97-
_selected = recent.pick.value
95+
def _(hm, recent):
96+
recent_result = hm.query_result(recent.result, label="Recent result")
97+
return (recent_result,)
98+
99+
100+
@app.cell
101+
def _(mo, recent, recent_result):
102+
recent_tab = mo.vstack([recent.ui, recent_result], gap=2)
103+
return (recent_tab,)
104+
105+
106+
@app.cell
107+
def _(browser_ui, history, mo, recent_tab, sql_tab, status, workspace):
108+
mo.ui.tabs({
109+
"Workspaces": workspace.ui,
110+
"Connections": status,
111+
"Datasets": browser_ui,
112+
"SQL query": sql_tab,
113+
"Recent results": recent_tab,
114+
"Run history": history,
115+
})
98116
return
99117

100118

0 commit comments

Comments
 (0)