You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,16 @@
2
2
3
3
Marimo UI helpers for [Hotdata](https://hotdata.dev): run SQL from a notebook, browse catalog metadata, and render results as tables.
4
4
5
+
## Features
6
+
7
+
-**Workspace-aware setup** — build a `HotdataClient` from environment variables, or use `workspace_selector_from_env()` to choose a workspace interactively when no workspace is pinned.
8
+
-**Connection health** — show a compact status callout with API, workspace, and optional sandbox context.
9
+
-**Catalog browsing** — browse Hotdata connections, schemas, tables, and columns from Marimo UI controls.
10
+
-**SQL editor widget** — run SQL against Hotdata, cache the latest successful result, and render results in downstream reactive cells.
11
+
-**Native `mo.sql` engine** — register `HotdataMarimoEngine` so Marimo SQL cells can execute through a live `HotdataClient` with `engine=client`.
12
+
-**Result display helpers** — render query results, recent results, and run history as notebook-friendly UI.
13
+
-**Marimo UI aliases** — importing `hotdata_marimo` attaches helpers such as `mo.ui.hotdata_sql_editor` and `mo.ui.hotdata_table_browser` for discoverability.
14
+
5
15
## Install
6
16
7
17
```bash
@@ -39,13 +49,45 @@ Importing `hotdata_marimo` registers discoverability aliases on Marimo’s UI na
39
49
40
50
Use `hm.connection_status(client)` (or `mo.ui.hotdata_connection_status(client)`) for a small API/workspace health callout.
41
51
52
+
## Marimo SQL Cells
53
+
54
+
Register the Hotdata SQL engine once during setup, then pass a `HotdataClient` to Marimo SQL cells:
55
+
56
+
```python
57
+
import hotdata_marimo as hm
58
+
59
+
hm.register_hotdata_sql_engine()
60
+
client = hm.from_env()
61
+
```
62
+
63
+
```python
64
+
_df = mo.sql(
65
+
"""
66
+
SELECT 1 AS example_value
67
+
""",
68
+
engine=client,
69
+
)
70
+
```
71
+
72
+
The engine also exposes Hotdata catalog metadata to Marimo's data-source UI. Hotdata connections are labeled **Hotdata** in the SQL connection picker.
73
+
42
74
## Two-cell pattern
43
75
44
76
Keep the editor in one cell and consume `editor.result` in another. The editor caches the last successful run so downstream cells do not re-query the API on every refresh; click **Run on Hotdata** again after you change SQL. While a query is running, a Marimo status spinner is shown.
45
77
46
78
Marimo only shows **what you `return` from a cell**. Calling `mo.vstack(...)` or `hm.query_result(...)` without returning it produces no visible output.
47
79
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.
80
+
See `examples/demo.py` for a full runnable notebook flow.
81
+
82
+
## Examples
83
+
84
+
-`examples/demo.py` — end-to-end browser + editor + result rendering flow.
85
+
86
+
Run:
87
+
88
+
```bash
89
+
uv run marimo edit examples/demo.py --no-token
90
+
```
49
91
50
92
## Layout
51
93
@@ -58,7 +100,7 @@ This package depends on [**hotdata-runtime**](https://github.com/hotdata-dev/hot
58
100
```bash
59
101
uv sync --locked
60
102
uv run pytest
61
-
marimo edit examples/hotdata_basic.py --no-token
103
+
marimo edit examples/demo.py --no-token
62
104
```
63
105
64
106
To pin **hotdata-runtime** from Git instead of the sibling path, remove the `[tool.uv.sources]` block, set the dependency line as needed, and run `uv lock` again.
0 commit comments