Skill v0.44.1
currentAutomated scan100/100name: hotdata-analytics 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 instant 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. version: 0.44.1
Hotdata Analytics Skill
OLAP-style analytics in Hotdata: PostgreSQL-dialect SQL, query execution, run history, stored results, Chain materializations, and sorted indexes for filters and joins.
Prerequisites: Authenticate, workspace, and catalog discovery via the `hotdata` skill (ingest sources/ingest, databases tables, databases).
Related sub-skills (bundled alongside this one — Read on demand): `hotdata-search` (`../search/SKILL.md` — BM25, vector, retrieval indexes), `hotdata-geospatial` (`../geospatial/SKILL.md` — spatial SQL).
Execute SQL
hotdata query "<sql>" [--workspace-id <workspace_id>] [--database <database>] [--dialect hotsql|duckdb|postgres|snowflake] [--output table|json|csv]hotdata query status <query_run_id>
- PostgreSQL dialect. Quote mixed-case identifiers:
"CustomerName". - `--dialect` (default
hotsql): write SQL induckdb/postgres/snowflakeand the server transpiles it to HotSQL before running (e.g. SnowflakeIFF(...), DuckDBlen(...)). Writes follow the same rules ashotsql. - Writes:
INSERT(append only),CREATE TABLE,CREATE TABLE AS SELECT, andDROP TABLErun throughqueryagainst the current database's own tables and return one row,rows_affected;UPDATE/DELETEare not supported in SQL yet (use keyedhotdata databases load --mode update|delete|upsert). Rules and refusals in the `hotdata` skill → Execute SQL Query. - Use `hotdata databases tables list` for schema discovery — not
information_schemaviaquery. - Fully qualified names:
<catalog>.<schema>.<table>,<database>.<schema>.<table>. - Query scope: every query runs inside one instant database (active or
--database); it sees that database's own catalog plus whatever is attached to it only. To read another database's table, or join your own table against one, attach that database first:hotdata databases attach <database>— see `hotdata` skill → Querying across databases. No instant database set → "a database is required." - Long-running queries may return
query_run_id→ poll with `query status` — exit0succeeded,1failed,2still running (poll again),3succeeded but the printed result is an incomplete/truncated preview. Do not re-run identical heavy SQL while polling. - Big result sets: use
-o csvor-o json— both stream the full persisted result with flat memory.-o tableis a human view capped at 10,000 rows; past that the footer readsN of TOTAL rows — INCOMPLETE PREVIEWand the command exits3. Details in the `hotdata` skill → Execute SQL Query. - For workspace-wide joins and naming, load context:DATAMODEL when listed (
hotdata databases context list→show DATAMODEL) — see `hotdata` skill.
OLAP patterns
Typical analytics SQL (all via hotdata query):
- Aggregations:
COUNT,SUM,AVG,MIN,MAXwithGROUP BY - Joins:
INNER/LEFT JOINacross<catalog>.<schema>.<table>names — every referenced catalog (the instant database's own or an attached one) must be in the current database's scope; attach catalogs first (hotdata databases attach) - Filtering:
WHEREon partition-friendly columns (consider sorted indexes below) - Ordering:
ORDER BYon metrics or dimensions - Bounded exploration: always
LIMITwhile iterating; widen once validated
Column names from CSV uploads may be case-sensitive — use double quotes when not all-lowercase.
Query run history
Scoped to the current database (set with hotdata databases use); pass -d/--database <database> (name, catalog alias, or id) to target another, -w/--workspace-id for another workspace.
hotdata databases queries list [-d <db-id>] [--workspace-id <workspace_id>] [--limit <int>] [--cursor <token>] [--status <csv>] [--output table|json|yaml]hotdata databases queries <query_run_id> [-d <db-id>] [--workspace-id <workspace_id>] [--output table|json|yaml]
list— status, duration, row count, SQL preview (default limit 20). Filter:--status running,failed.<query_run_id>— full metadata, formatted SQL,result_idwhen present.- Use history to find recurring
WHERE/JOIN/GROUP BYpatterns before adding indexes (search skill) or chains.
Stored results
hotdata databases results list [-d <db-id>] [--workspace-id <workspace_id>] [--limit <int>] [--offset <int>] [--output table|json|yaml]hotdata databases results get <result_id> [-d <db-id>] [--workspace-id <workspace_id>] [--output table|json|csv]
- Prefer `databases results get <id>` over re-running identical heavy queries. It renders like
query:csv/jsonstream the whole result,tableis capped at 10,000 rows and exits3when the result is larger. Results and query runs scope to the current database; pass-d/--database <database>(name, catalog alias, or id) to target another. - Query footers may include
[result-id: rslt...]; also available fromdatabases queries <query_run_id>. databases results list --limitdefaults to 100 (max 1000) — unlikedatabases queries list, which defaults to 20.
Chain (materialized follow-ups)
Pattern: run SQL → materialize a smaller table → query the materialized name.
- Base query
``bash hotdata query "SELECT ..." hotdata query status <query_run_id> # if async ``
- Materialize into an instant database (parquet)
``bash hotdata databases create --catalog analytics # prints the new id hotdata databases use <id> # create does not switch hotdata databases load --catalog analytics --table slice --file ./slice.parquet ``
- Chain query — use the catalog-qualified name
<catalog>.public.<table>:
``bash hotdata query "SELECT * FROM analytics.public.slice WHERE ..." ``
Document stable chains in context:DATAMODEL → Derived tables (Chain).
Full procedure: references/WORKFLOWS.md.
Sorted indexes (filters and range scans)
For equality, range, and sort-heavy OLAP — not full-text or vector (see `hotdata-search`):
hotdata search create idx_orders_created --type sorted \--from <catalog-alias>.<schema>.<table> --column created_at [--async]
List and remove use the same hotdata search commands as in the search skill; only `--type sorted` is the analytics focus here. With --async, track the build via `hotdata jobs list` (see `hotdata` skill → Jobs).