Skip to content

Commit 2c136bf

Browse files
authored
feat: scope all commands to active database; remove connections command (#221)
* feat: scope tables list to active database when set * feat: add results show, tables show; remove connections command * refactor: scope tables to databases, remove --connection-id from list * fix: tables show uses catalog name in TABLE column, not internal connection ID * docs: update skills — remove connections, add tables show/results show * Scope indexes list to the active database When a database is active, indexes list automatically narrows to that database connection ID. Falls back to workspace-wide when none is set. * Scope search to databases: catalog.schema.table or schema.table with active DB --table now accepts schema.table (resolves catalog from active database) or the full catalog.schema.table form. Removes the old connection.table syntax. Also updates hotdata-search SKILL.md to match. * Remove --connection-id from indexes delete; --catalog is now required * Fix tables list: honor --table filter and fall through on --limit/--cursor When an active database is set, --table now passes through to the API instead of being silently dropped. --limit and --cursor fall through to tables::list (which supports pagination) rather than the active-db path. * Fix codex review findings: stale tests and active-DB scoping with --limit/--cursor P1: Remove stale tests that pattern-matched IndexesCommands::Delete with the old connection_id field; update to match the new catalog-only shape. P2: tables list now always uses the active-database path when a DB is set, even with --limit/--cursor. collect_tables does a single paged fetch when limit/cursor are provided, so pagination works and the TABLE column stays catalog-prefixed. * Fix error message: 'no catalog with id' instead of 'no connection named or with id' * Add unit tests for collect_tables, indexes list args, and results show args Fixes failing table-filter test: mockito matcher used 'table_name' but the SDK sends 'table' as the query parameter. * fmt: apply rustfmt --------- Co-authored-by: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com>
1 parent 417caa4 commit 2c136bf

11 files changed

Lines changed: 510 additions & 1501 deletions

File tree

skills/hotdata-analytics/SKILL.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: hotdata-analytics
3-
description: Use this skill when the user wants OLAP-style SQL analytics in Hotdata — aggregations, GROUP BY, JOINs, reporting, exploratory queries, query run history, stored results, or materialized follow-up tables (Chain into managed databases). Activate for "analyze", "aggregate", "rollup", "pivot", "report", "metrics", "GROUP BY", "query history", "past queries", "query runs", "stored results", "materialize", "chain", "intermediate table", or sorted indexes for filters/range scans. Do not load for BM25/vector search or geospatial SQL — use hotdata-search or hotdata-geospatial. Requires the core hotdata skill for connections, tables, and auth.
3+
description: Use this skill when the user wants OLAP-style SQL analytics in Hotdata — aggregations, GROUP BY, JOINs, reporting, exploratory queries, query run history, stored results, or materialized follow-up tables (Chain into managed databases). Activate for "analyze", "aggregate", "rollup", "pivot", "report", "metrics", "GROUP BY", "query history", "past queries", "query runs", "stored results", "materialize", "chain", "intermediate table", or sorted indexes for filters/range scans. Do not load for BM25/vector search or geospatial SQL — use hotdata-search or hotdata-geospatial. Requires the core hotdata skill for tables and auth.
44
version: 0.15.0
55
---
66

@@ -61,10 +61,11 @@ hotdata queries <query_run_id> [--output table|json|yaml]
6161

6262
```bash
6363
hotdata results list [--workspace-id <workspace_id>] [--limit <int>] [--offset <int>] [--output table|json|yaml]
64-
hotdata results <result_id> [--workspace-id <workspace_id>] [--output table|json|csv]
64+
hotdata results show <result_id> [--workspace-id <workspace_id>] [--output table|json|csv]
65+
hotdata results <result_id> [--workspace-id <workspace_id>] [--output table|json|csv] # shorthand
6566
```
6667

67-
- Prefer **`results <id>`** over re-running identical heavy queries.
68+
- Prefer **`results show <id>`** over re-running identical heavy queries. The positional shorthand `results <id>` also works.
6869
- Query footers may include `[result-id: rslt...]`; also available from `queries <query_run_id>`.
6970
- `results list --limit` defaults to **100** (max **1000**) — unlike `queries list`, which defaults to **20**.
7071

skills/hotdata-search/SKILL.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 0.15.0
88

99
Retrieval workloads in Hotdata: **BM25 full-text**, **vector similarity**, and the **indexes** and **embedding providers** that power them.
1010

11-
**Prerequisites:** Authenticate and select a workspace (see the **`hotdata`** skill). Use fully qualified table names: `<connection>.<schema>.<table>`.
11+
**Prerequisites:** Authenticate, set a workspace, and set an active database (`hotdata databases set <id>`) — see the **`hotdata`** skill. Use fully qualified table names: `<catalog>.<schema>.<table>`.
1212

1313
**Related skills:** **`hotdata-analytics`** (OLAP SQL, query history, materialized chains), **`hotdata-geospatial`** (PostGIS-style functions).
1414

@@ -20,12 +20,15 @@ Both run server-side. `--type` and `--column` are **optional** when the table ha
2020

2121
```bash
2222
# BM25 (requires a BM25 index on the column)
23-
hotdata search "<query>" --table <connection.schema.table> [--type bm25] [--column <column>] \
23+
hotdata search "<query>" --table <catalog.schema.table> [--type bm25] [--column <column>] \
2424
[--select <columns>] [--limit <n>] [--workspace-id <workspace_id>] [--output table|json|csv]
2525

2626
# Vector (requires a vector index; server auto-embeds the query text)
27-
hotdata search "<query>" --table <connection.schema.table> [--type vector] [--column <source_text_column>] \
27+
hotdata search "<query>" --table <catalog.schema.table> [--type vector] [--column <source_text_column>] \
2828
[--select <columns>] [--limit <n>] [--workspace-id <workspace_id>] [--output table|json|csv]
29+
30+
# With active database: schema.table is enough (catalog resolved from active DB)
31+
hotdata search "<query>" --table <schema.table> [--type bm25|vector] [--column <col>]
2932
```
3033

3134
| Type | Behavior |
@@ -37,28 +40,26 @@ hotdata search "<query>" --table <connection.schema.table> [--type vector] [--co
3740
- **Custom embedding model, raw query vector, or no vector index?** Use `hotdata query` directly (e.g. `cosine_distance(col, [<vec>])`) — `search` only auto-embeds the query text via the index's own provider.
3841
- **Before search:** create the right index (`indexes create --type bm25` or `--type vector`). See [references/INDEXES.md](references/INDEXES.md).
3942
- Default `--limit` is 10.
40-
- **Managed databases:** set the database active (`hotdata databases set <db>`) and reference the table by its **SQL catalog**`<default_catalog>.<schema>.<table>`, usually `default.public.<table>`. Do **not** use the internal `__db_<id>` label that `indexes list` displays, nor a connection id `bm25_search`/`vector_distance` resolve a catalog attached to the active database, so a `__db_…` or `conn…` prefix errors with *catalog … is not attached*.
43+
- **Active database:** with `hotdata databases set <db>`, you can pass `schema.table` directly (e.g. `--table public.articles`)the active database's catalog is resolved automatically. Or use the full `catalog.schema.table` form. Do **not** use the internal `__db_<id>` label or raw connection ID prefix `bm25_search`/`vector_distance` resolve a catalog attached to the active database, so an `__db_…` or `conn…` prefix errors with *catalog … is not attached*.
4144

4245
---
4346

4447
## Indexes (BM25 and vector)
4548

46-
Create attaches to a table via its `--catalog` alias (a managed-database catalog or a connection name). `list` filters by any of `--connection-id` (short `-c`) / `--schema` / `--table` (all optional). `delete` **requires all of** `--connection-id` (short `-c`) + `--schema` + `--table` + `--name`.
47-
48-
**Unscoped `hotdata indexes list` (no `--connection-id`) scans the whole workspace — both regular connections *and* managed databases** — so managed-database indexes appear without any flags. In that whole-workspace view the `table` column shows a managed database under its internal `__db_<id>.<schema>.<table>` label (a connection-scoped `indexes list --connection-id <db-conn>` shows the same rows).
49+
Create attaches to a table via its `--catalog` alias (a managed-database catalog or a connection name). `list` narrows to the **active database** when one is set; without one it scans the whole workspace. Filter further with `--schema` / `--table`. `delete` **requires all of** `--catalog` + `--schema` + `--table` + `--name`.
4950

5051
```bash
51-
# List — whole-workspace scan, incl. managed databases (filter by connection, schema, or table)
52-
hotdata indexes list [--connection-id <id>] [--schema <schema>] [--table <table>] [--workspace-id <ws>] [--output table|json|yaml]
52+
# List — active-database scope when a DB is set, else whole-workspace scan
53+
hotdata indexes list [--schema <schema>] [--table <table>] [--workspace-id <ws>] [--output table|json|yaml]
5354

5455
# Create — by catalog alias (resolves a managed-database catalog or a connection name)
5556
hotdata indexes create --catalog <alias> --schema <schema> --table <table> \
5657
--column <col> --type bm25|vector \
5758
[--name <name>] [--metric l2|cosine|dot] [--async] \
5859
[--embedding-provider-id <id>] [--dimensions <n>] [--output-column <name>] [--description <text>]
5960

60-
# Delete — requires --connection-id + --schema + --table + --name
61-
hotdata indexes delete --connection-id <id> --schema <schema> --table <table> --name <name>
61+
# Delete — requires --catalog + --schema + --table + --name
62+
hotdata indexes delete --catalog <alias> --schema <schema> --table <table> --name <name>
6263
```
6364

6465
- **`--type` is required** on create: `bm25` (one or more text columns, comma-separated in `--column`) or `vector` (exactly one column; often embeddings or auto-embedded text). (`sorted` is also a valid `--type`, covered in **`hotdata-analytics`**.)
@@ -88,8 +89,8 @@ hotdata embedding-providers delete <id> [--workspace-id <workspace_id>]
8889

8990
## Quick workflow
9091

91-
1. `hotdata tables list --connection-id <id>` — confirm column types.
92-
2. `hotdata indexes list` — avoid duplicate indexes.
92+
1. `hotdata databases set <id>` set an active database, then `hotdata tables list` to confirm column types.
93+
2. `hotdata indexes list` — avoid duplicate indexes (scoped to active DB automatically).
9394
3. `hotdata indexes create --catalog <alias> --table <table> --column <col> --type bm25|vector` (add `--async` if large).
94-
4. `hotdata search "..." --table <catalog.table>``--type` and `--column` are inferred when there is one search index.
95+
4. `hotdata search "..." --table <schema.table>``--type` and `--column` are inferred when there is one search index.
9596
5. Record what exists in **context:DATAMODEL** (core skill) when the workspace should remember index choices.

0 commit comments

Comments
 (0)