Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/hotdata-analytics/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ hotdata results <result_id> [--workspace-id <workspace_id>] [--output table|json
Or managed parquet:

```bash
hotdata databases create --description "analytics" --table slice
hotdata databases create --name analytics --table slice
hotdata databases set <returned-id>
hotdata databases tables load slice --file ./slice.parquet
```
Expand Down
10 changes: 5 additions & 5 deletions skills/hotdata/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ hotdata connections create \

```
hotdata databases list [--workspace-id <workspace_id>] [--output table|json|yaml]
hotdata databases create [--description <label>] [--table <table> ...] [--schema public] [--expires-at <duration|timestamp>] [--workspace-id <workspace_id>] [--output table|json|yaml]
hotdata databases create [--name <catalog_name>] [--table <table> ...] [--schema public] [--expires-at <duration|timestamp>] [--workspace-id <workspace_id>] [--output table|json|yaml]
hotdata databases set <id_or_description>
hotdata databases <id_or_description> [--workspace-id <workspace_id>] [--output table|json|yaml]
hotdata databases delete <id_or_description> [--workspace-id <workspace_id>]
hotdata databases run [--database <id>] [--description <label>] [--schema public] [--table <table> ...] [--expires-at <duration|timestamp>] [--workspace-id <workspace_id>] <cmd> [args...]
hotdata databases run [--database <id>] [--name <catalog_name>] [--schema public] [--table <table> ...] [--expires-at <duration|timestamp>] [--workspace-id <workspace_id>] <cmd> [args...]

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.

nit: this rename was applied here but README.md still documents the old flag for the same command and was missed — README.md:140 shows hotdata databases run [--database <id>] [--description <label>] ... and README.md:151 says "auto-create a scratch one using --description / --schema / ...". Since databases run no longer accepts --description, the README now documents a flag that errors. Update both for consistency. (not blocking)

hotdata databases <id> run <cmd> [args...]

# Dot-notation shorthand for load: database.table or database.schema.table
Expand All @@ -203,20 +203,20 @@ hotdata databases tables delete <table> [--database <id_or_desc>] [--schema publ
```

- `list` — all managed databases in the workspace.
- `create` — creates a new managed database. `--description` is an optional human-readable label (databases are addressed by id, not description). `--expires-at` accepts relative durations (`24h`, `7d`, `90m`) or an RFC 3339 timestamp; defaults to `24h` when omitted. Repeat `--table` to declare tables up front.
- `create` — creates a new managed database. `--name` is an optional catalog alias used in queries (`SELECT … FROM <name>.public.<table>`); must be `[a-z_][a-z0-9_]*`. `--expires-at` accepts relative durations (`24h`, `7d`, `90m`) or an RFC 3339 timestamp; defaults to `24h` when omitted. Repeat `--table` to declare tables up front.
- `set` — saves `<id_or_description>` as the active database. Subsequent `databases tables` and `context` commands use it automatically.
- `<id_or_description>` — inspect one database (id, description, expires_at).

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.

super nit: while you're aligning terminology with the --name rename, the surrounding placeholders here still use <id_or_description> (lines 186, 191, 192, 193, 207) and this line lists the output field as description — but databases get prints name:, not description: (src/databases.rs:417). Consider <id_or_name> and (id, name, expires_at) for consistency. (not blocking)

- `delete` — removes the managed database; clears the active-database config if it matched.
- `load` — shorthand with dot notation (`database.table` or `database.schema.table`). Schema defaults to `public`.
- `tables list` — lists tables with `TABLE` (`<database_id>.<schema>.<table>`), `SYNCED`, `LAST_SYNC`. Uses active database when `--database` is omitted.
- `tables load` — uploads a local parquet file (`--file`), a remote parquet URL (`--url`), or a pre-staged upload (`--upload-id`) and publishes with **replace** mode.
- `tables delete` — drops a table from the managed database.
- `run` — mints a database-scoped JWT (via `POST /v1/auth/database`) and execs `<cmd>` with `HOTDATA_DATABASE_TOKEN`, `HOTDATA_DATABASE_REFRESH_TOKEN`, `HOTDATA_DATABASE`, `HOTDATA_WORKSPACE`, and `HOTDATA_API_URL` injected. Pass a database id as a group positional (`hotdata databases <id> run ...`, sandbox-style) or via `--database <id>`; omit both to auto-create a scratch database using `--description` / `--schema` / `--table` / `--expires-at`. Use this to launch an agent or child process whose API access is scoped to a single database. The minted JWT carries `database`, `workspaces`, `permissions:["read","write"]`, `source:"database_token"`. The session is persisted at `~/.hotdata/database_session.json` (mode `0600`); the child's exit code is propagated.
- `run` — mints a database-scoped JWT (via `POST /v1/auth/database`) and execs `<cmd>` with `HOTDATA_DATABASE_TOKEN`, `HOTDATA_DATABASE_REFRESH_TOKEN`, `HOTDATA_DATABASE`, `HOTDATA_WORKSPACE`, and `HOTDATA_API_URL` injected. Pass a database id as a group positional (`hotdata databases <id> run ...`, sandbox-style) or via `--database <id>`; omit both to auto-create a scratch database using `--name` / `--schema` / `--table` / `--expires-at`. Use this to launch an agent or child process whose API access is scoped to a single database. The minted JWT carries `database`, `workspaces`, `permissions:["read","write"]`, `source:"database_token"`. The session is persisted at `~/.hotdata/database_session.json` (mode `0600`); the child's exit code is propagated.

Example:

```
hotdata databases create --description "sales" --table orders
hotdata databases create --name sales --table orders
hotdata databases set <returned-id>
hotdata databases tables load orders --file ./orders.parquet
hotdata query "SELECT count(*) FROM <database_id>.public.orders"
Expand Down
4 changes: 2 additions & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,9 @@ pub enum DatabasesCommands {
#[arg(long)]
database: Option<String>,

/// Description for the auto-created database (only used when --database is omitted)
/// Name for the auto-created database (only used when --database is omitted)
#[arg(long)]
description: Option<String>,
name: Option<String>,

/// Schema for tables declared in the auto-created database (default: public)
#[arg(long, default_value = "public")]
Expand Down
8 changes: 4 additions & 4 deletions src/databases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ pub fn get(workspace_id: &str, id_or_name: &str, format: &str) {
/// the id instead of printing.
fn create_and_return_id(
api: &ApiClient,
description: Option<&str>,
name: Option<&str>,
schema: &str,
tables: &[String],
expires_at: Option<&str>,
) -> String {
use crossterm::style::Stylize;
let body = create_database_request(description, schema, tables, expires_at);
let body = create_database_request(name, schema, tables, expires_at);
let (status, resp_body) = api.post_raw("/databases", &body);
if !status.is_success() {
eprintln!("{}", crate::util::api_error(resp_body).red());
Expand Down Expand Up @@ -493,7 +493,7 @@ fn mint_database_token(api: &ApiClient, database_id: &str) -> DatabaseTokenRespo
pub fn run(
database: Option<&str>,
workspace_id: &str,
description: Option<&str>,
name: Option<&str>,
schema: &str,
tables: &[String],
expires_at: Option<&str>,
Expand All @@ -509,7 +509,7 @@ pub fn run(
// for the child process, addressed only by the token we mint below.
let database_id = match database {
Some(id) => id.to_string(),
None => create_and_return_id(&api, description, schema, tables, expires_at),
None => create_and_return_id(&api, name, schema, tables, expires_at),
};

let resp = mint_database_token(&api, &database_id);
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ fn main() {
// group-level name_or_id is treated as a `show` shorthand.
if let Some(DatabasesCommands::Run {
database,
description,
name,
schema,
tables,
expires_at,
Expand All @@ -414,7 +414,7 @@ fn main() {
databases::run(
db,
&workspace_id,
description.as_deref(),
name.as_deref(),
&schema,
&tables,
expires_at.as_deref(),
Expand Down
Loading