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
feat(databases): add --catalog flag to databases create (#125)
* feat(databases): add --catalog flag to databases create
Maps to the default_catalog field on POST /v1/databases, separating
the human-readable --name from the SQL catalog alias used in queries.
Also fixes config tests that failed when HOTDATA_API_KEY was set in the
environment by unsetting it inside the with_temp_config_dir test helper.
* fix(databases): correct expires_at doc — omitting always means no expiry
* fix(databases): add default_catalog to Database struct; use catalog in all output
- Add `default_catalog` field to `Database` struct so `databases show`
and table commands use the correct SQL alias instead of falling back
to the display name
- Use default_catalog (falling back to name, then "default") in
databases show sql_prefix, tables list full_name, tables load, and
tables delete output
- Fix --catalog arg doc: remove stale 24h expiry claim
- Update README and skills/hotdata/SKILL.md to document --name as
display name and --catalog as the SQL alias, with corrected examples
---------
Co-authored-by: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com>
Managed databases are Hotdata-owned catalogs you create and populate yourself (no remote source to sync). Query them with SQL as `database_name.schema.table` — the database name is the connection name.
133
+
Managed databases are Hotdata-owned catalogs you create and populate yourself (no remote source to sync). Query them with SQL as `<catalog>.schema.table`.
134
134
135
135
```sh
136
136
hotdata databases list [-w <id>] [-o table|json|yaml]
-`create` registers a managed connection (`source_type: managed`) with no external credentials. Use `--table` to declare tables up front (required before `tables load` on the current API).
149
+
-`create` registers a managed connection with no external credentials. `--name` is a human-readable display name; `--catalog` sets the SQL alias used in queries (`SELECT … FROM <catalog>.schema.table`) and must be `[a-z_][a-z0-9_]*`. Use `--table` to declare tables up front (required before `tables load` on the current API).
150
150
-`tables load` uploads a **parquet** file (or uses a staged `upload_id` from `POST /v1/files`) and publishes it as the table generation (`replace` mode).
151
-
-`run` mints a database-scoped JWT and execs `<cmd>` with `HOTDATA_DATABASE_TOKEN`, `HOTDATA_DATABASE_REFRESH_TOKEN`, `HOTDATA_DATABASE`, `HOTDATA_WORKSPACE`, and `HOTDATA_API_URL` injected into its environment. Pass a database id (group-positional `<id>` like `sandbox run`, or `--database <id>`) to scope an existing database; omit both to auto-create a scratch one using `--description` / `--schema` / `--table` / `--expires-at`. Useful for launching an agent or child process whose API access is restricted to a single database.
151
+
-`run` mints a database-scoped JWT and execs `<cmd>` with `HOTDATA_DATABASE_TOKEN`, `HOTDATA_DATABASE_REFRESH_TOKEN`, `HOTDATA_DATABASE`, `HOTDATA_WORKSPACE`, and `HOTDATA_API_URL` injected into its environment. Pass a database id (group-positional `<id>` like `sandbox run`, or `--database <id>`) to scope an existing database; omit both to auto-create a scratch one using `--name` / `--schema` / `--table` / `--expires-at`. Useful for launching an agent or child process whose API access is restricted to a single database.
152
152
- For CSV/JSON uploads without a managed database, use `hotdata datasets create` instead (`datasets.main.*`).
-`create` — creates a new managed database. `--name` is an optional catalogalias 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.
207
-
-`set` — saves `<id_or_description>` as the active database. Subsequent `databases tables` and `context` commands use it automatically.
208
-
-`<id_or_description>` — inspect one database (id, description, expires_at).
206
+
-`create` — creates a new managed database. `--name` is an optional human-readable display name. `--catalog` sets the SQL alias used in queries (`SELECT … FROM <catalog>.schema.table`); must be `[a-z_][a-z0-9_]*`. `--expires-at` accepts relative durations (`24h`, `7d`, `90m`) or an RFC 3339 timestamp; omitting means no expiry. Repeat `--table` to declare tables up front.
207
+
-`set` — saves `<id_or_name>` as the active database. Subsequent `databases tables` and `context` commands use it automatically.
208
+
-`<id_or_name>` — inspect one database (id, catalog, name, expires_at).
209
209
-`delete` — removes the managed database; clears the active-database config if it matched.
210
210
-`load` — shorthand with dot notation (`database.table` or `database.schema.table`). Schema defaults to `public`.
211
-
-`tables list` — lists tables with `TABLE` (`<database_id>.<schema>.<table>`), `SYNCED`, `LAST_SYNC`. Uses active database when `--database` is omitted.
211
+
-`tables list` — lists tables with `TABLE` (`<catalog>.<schema>.<table>`), `SYNCED`, `LAST_SYNC`. Uses active database when `--database` is omitted.
212
212
-`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.
213
213
-`tables delete` — drops a table from the managed database.
214
214
-`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.
0 commit comments