Skip to content

Commit 066dccf

Browse files
committed
fix(databases): use name not description for API alignment
The Hotdata API renamed the database identifier field from `description` to `name`. This updates: - `try_resolve_database`: filter by `d.name` instead of `d.description` so that `hotdata databases get <name>` works against the new API - `databases set`: accept the database id directly rather than resolving by name/description — the id is unambiguous and always available - Error messages and help text: "id or description" → "id or name" - Tests: update mock payloads to return `name` (not `description`)
1 parent bfabb45 commit 066dccf

3 files changed

Lines changed: 113 additions & 60 deletions

File tree

src/command.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub enum Commands {
7575

7676
/// Managed databases you create and populate with tables (parquet uploads)
7777
Databases {
78-
/// Database id or description (omit to use a subcommand)
78+
/// Database id or name (omit to use a subcommand)
7979
name_or_id: Option<String>,
8080

8181
/// Workspace ID (defaults to first workspace from login)
@@ -563,20 +563,32 @@ pub enum DatabasesCommands {
563563

564564
/// Create a new managed database
565565
Create {
566-
/// Optional display label (not unique, not an identifier — databases are addressed by id)
566+
/// SQL catalog alias — becomes the catalog name in queries:
567+
/// SELECT … FROM <name>.public.<table>.
568+
/// Must be [a-z_][a-z0-9_]*, globally unique. When provided the
569+
/// database defaults to no expiry; omit for an anonymous 24h sandbox.
570+
#[arg(long)]
571+
name: Option<String>,
572+
573+
/// Optional display label (not unique, not an identifier)
567574
#[arg(long)]
568575
description: Option<String>,
569576

570-
/// Schema for tables declared at create time (default: public)
577+
/// Default schema for bare `--table` entries (default: public).
578+
/// Use dot notation in `--table` to target a different schema directly,
579+
/// e.g. `--table raw.raw_orders` always goes into the "raw" schema.
571580
#[arg(long, default_value = "public")]
572581
schema: String,
573582

574-
/// Table to declare up front (repeatable)
583+
/// Table to declare up front (repeatable). Accepts bare names or
584+
/// `schema.table` dot notation to span multiple schemas in one command:
585+
/// --table orders --table raw.raw_orders --table raw.raw_customers
575586
#[arg(long = "table")]
576587
tables: Vec<String>,
577588

578589
/// When the database expires. Accepts a relative duration (e.g. 24h, 7d, 90m)
579-
/// or an RFC 3339 timestamp. Defaults to 24h when omitted.
590+
/// or an RFC 3339 timestamp. Omitting with --name means no expiry; omitting
591+
/// without --name defaults to 24h.
580592
#[arg(long)]
581593
expires_at: Option<String>,
582594

@@ -587,8 +599,8 @@ pub enum DatabasesCommands {
587599

588600
/// Set the current database (used by default when no database is specified)
589601
Set {
590-
/// Database id or description
591-
id_or_description: String,
602+
/// Database id
603+
id: String,
592604
},
593605

594606
/// Delete a managed database and its tables
@@ -618,7 +630,7 @@ pub enum DatabasesCommands {
618630

619631
/// Manage tables inside a managed database
620632
Tables {
621-
/// Database id or description — shorthand for `tables list` when no subcommand is given
633+
/// Database id or name — shorthand for `tables list` when no subcommand is given
622634
database: Option<String>,
623635

624636
#[command(subcommand)]
@@ -630,7 +642,7 @@ pub enum DatabasesCommands {
630642
pub enum DatabaseTablesCommands {
631643
/// List tables in a managed database
632644
List {
633-
/// Database id or description (defaults to current database)
645+
/// Database id or name (defaults to current database)
634646
#[arg(long)]
635647
database: Option<String>,
636648

@@ -645,7 +657,7 @@ pub enum DatabaseTablesCommands {
645657

646658
/// Load a parquet file into a table (creates or replaces the table)
647659
Load {
648-
/// Database id or description (defaults to current database)
660+
/// Database id or name (defaults to current database)
649661
#[arg(long)]
650662
database: Option<String>,
651663

@@ -671,7 +683,7 @@ pub enum DatabaseTablesCommands {
671683

672684
/// Delete a table from a managed database
673685
Delete {
674-
/// Database id or description (defaults to current database)
686+
/// Database id or name (defaults to current database)
675687
#[arg(long)]
676688
database: Option<String>,
677689

0 commit comments

Comments
 (0)