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
-`columns_for_qualified(qualified, connection_id=...)` resolves table columns, and
51
+
adapters should pass `connection_id` when known.
52
+
53
+
### `QueryResult`
54
+
55
+
- Canonical tabular result model with `columns`, `rows`, and `row_count`.
56
+
- Carries server identifiers and execution metadata when available.
57
+
-`to_pandas()` converts to a DataFrame with stable column ordering.
58
+
-`to_records(max_rows=...)` returns row dicts keyed by column names.
59
+
-`metadata_dict()` returns normalized result metadata for adapter rendering.
60
+
61
+
### Env Resolution
62
+
63
+
-`default_api_key()` reads `HOTDATA_API_KEY`.
64
+
-`default_host()` reads `HOTDATA_API_URL` (default: `https://api.hotdata.dev`) and normalizes it.
65
+
-`default_session_id()` reads `HOTDATA_SANDBOX`.
66
+
-`explicit_workspace_id()` reads `HOTDATA_WORKSPACE` (workspace public id).
67
+
-`pick_workspace()` prefers explicit env workspace, then active workspace, then first workspace.
68
+
-`resolve_workspace_selection()` is the canonical workspace selection algorithm. It returns `WorkspaceSelection` with selected workspace id, selection source, and discovered workspaces when auto-selected.
Copy file name to clipboardExpand all lines: README.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,32 @@
2
2
3
3
Shared runtime primitives for Hotdata integrations: workspace/session semantics, execution context, query state, run history, and replayable result handles. Framework packages (Marimo, Jupyter, Streamlit, LangGraph) depend on this package.
4
4
5
+
Runtime boundary and guarantees are defined in `CONTRACT.md`.
6
+
7
+
## Features
8
+
9
+
-**Environment-driven client setup** — create clients from `HOTDATA_API_KEY`, optional `HOTDATA_API_URL`, `HOTDATA_WORKSPACE`, and `HOTDATA_SANDBOX`.
10
+
-**Workspace resolution** — choose an explicit workspace from env, otherwise discover workspaces and select the active workspace or first available workspace.
11
+
-**Sandbox/session propagation** — pass sandbox session context through the SDK via `X-Session-Id`.
12
+
-**HTTP resilience** — configure SDK retries for transient connection failures and retry SQL execution on stale pooled sockets.
13
+
-**SQL execution helper** — run SQL through `POST /v1/query`, poll async query runs when needed, and return a `QueryResult`.
14
+
-**Result utilities** — convert query results to records, pandas DataFrames, or metadata dictionaries for adapter display layers.
15
+
-**History helpers** — list recent results and query run history with normalized dataclasses.
16
+
-**Health helpers** — build compact API/workspace health summaries for UI integrations.
17
+
5
18
Install:
6
19
7
20
```bash
8
21
uv pip install hotdata-runtime
9
22
# or: pip install hotdata-runtime
10
23
```
11
24
25
+
Example:
26
+
27
+
```bash
28
+
python examples/basic_usage.py
29
+
```
30
+
12
31
Development (uses **uv**; creates `.venv/` in this repo):
0 commit comments