Skip to content

docs(skill): document SQL writes through hotdata query - #354

Merged
eddietejeda merged 2 commits into
mainfrom
docs/sql-writes
Oct 18, 2026
Merged

eddietejeda merged 2 commits into
mainfrom
docs/sql-writes

Conversation

@eddietejeda

Copy link
Copy Markdown
Contributor

hotdata query can now run INSERT, CREATE TABLE, CREATE TABLE AS and DROP TABLE against the current database's own tables (runtimedb removed the sql_writes flag). Documents the rules and refusals in the README, the hotdata skill, and the analytics subskill. UPDATE/DELETE are documented as not supported yet, with keyed load modes as the alternative.

@eddietejeda
eddietejeda requested a review from a team as a code owner October 18, 2026 04:19
@eddietejeda
eddietejeda requested review from rohan-hotdata and removed request for a team October 18, 2026 04:19
Comment thread README.md Outdated
`query` also writes: `INSERT`, `CREATE TABLE`, `CREATE TABLE AS` and
`DROP TABLE` run against the current database's own tables (API key with the
`write` permission) and print one row, `rows_affected`. `UPDATE`/`DELETE` are
not supported in SQL yet — use `hotdata load --mode update|delete|upsert`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace hotdata load with hotdata databases load (or hotdata databases tables load). The CLI has no top-level load subcommand. src/cli.rs defines only auth, workspaces, databases, query, jobs, ingest, search, manage, support, usage, completions, upgrade, skills. A user who follows this line gets an unrecognized-subcommand error.

Suggested change
not supported in SQL yet — use `hotdata load --mode update|delete|upsert`.
not supported in SQL yet — use `hotdata databases load --mode update|delete|upsert`.

Comment thread skills/hotdata/SKILL.md Outdated
- **A query runs inside one instant database** (current database or `--database`); with none set it fails *"a database is required."* The scope sees the database's own catalog **plus whatever is attached to it only**. To read another database's tables or join across databases, attach it first — see [Querying across databases (attach)](#querying-across-databases-attach).
- Use `hotdata databases tables list` and `hotdata databases tables show` for discovery — not `information_schema` via `query`. (Discovery lists every workspace table; queryability still requires the table's catalog to be in the current database's scope.)
- **PostgreSQL dialect.** Quote non-lowercase columns with double quotes. To write DuckDB/Postgres/Snowflake SQL instead, pass `--dialect` (server-side transpile; writes follow the same rules as `hotsql`) — details in **`hotdata-analytics`**.
- **SQL writes.** `query` runs `INSERT INTO t [(cols)] VALUES …|SELECT …` (append only), `CREATE TABLE t (col TYPE, …)`, `CREATE TABLE t AS SELECT …`, and `DROP TABLE [IF EXISTS] t` against the **current database's own tables**; attached databases stay read-only. The API key needs the `write` permission. The result is one row, `rows_affected`. Each `INSERT` is a full publish (write lock, new generation, index maintenance), so **batch rows into one statement** and use `hotdata load` for anything of size. Refused: `UPDATE`/`DELETE` (*"not supported yet"* — use `hotdata load --mode update|delete|upsert` by key), `INSERT OVERWRITE`/`OR REPLACE`/`ON CONFLICT`/`RETURNING`, column constraints on `CREATE TABLE` (`NOT NULL`, `DEFAULT`, `PRIMARY KEY`, `UNIQUE` — every column is nullable), `ALTER`, views, `COPY`, transactions. A table with a vector index must be inserted into with a column list that omits the generated embedding column. Table layout (`--key`, partition, sort) is declared with `databases tables add`, not in SQL.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace both hotdata load references with hotdata databases load. The CLI has no top-level load subcommand (src/cli.rs). The rest of this skill uses hotdata databases load (lines 123, 159–179). An agent that follows this bullet runs a command that fails with an unrecognized-subcommand error.


- **PostgreSQL dialect.** Quote mixed-case identifiers: `"CustomerName"`.
- **`--dialect`** (default `hotsql`): write SQL in `duckdb`/`postgres`/`snowflake` and the server transpiles it to HotSQL before running (e.g. Snowflake `IFF(...)`, DuckDB `len(...)`). Writes follow the same rules as `hotsql`.
- **Writes:** `INSERT` (append only), `CREATE TABLE`, `CREATE TABLE AS SELECT`, and `DROP TABLE` run through `query` against the current database's own tables and return one row, `rows_affected`; `UPDATE`/`DELETE` are not supported in SQL yet (use keyed `hotdata load --mode update|delete|upsert`). Rules and refusals in the **`hotdata`** skill → Execute SQL Query.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace hotdata load with hotdata databases load. The CLI has no top-level load subcommand (src/cli.rs). An agent that follows this bullet runs a command that fails with an unrecognized-subcommand error.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — Blocking Issues

  • README.md:106, skills/hotdata/SKILL.md:273, skills/hotdata/subskills/analytics/SKILL.md:26: the docs name hotdata load. The CLI has no top-level load subcommand (src/cli.rs). Users and agents that follow these lines get an unrecognized-subcommand error.

Action Required

Replace every hotdata load --mode update|delete|upsert with hotdata databases load --mode update|delete|upsert. The command hotdata databases tables load is also valid. The skill already uses hotdata databases load elsewhere (skills/hotdata/SKILL.md:123).

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@eddietejeda
eddietejeda merged commit c04439b into main Oct 18, 2026
15 checks passed
@eddietejeda
eddietejeda deleted the docs/sql-writes branch October 18, 2026 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant