Skip to content

Commit 3f1b8ee

Browse files
eddietejedaclaude
andauthored
feat(datasets): narrow create to sql/query-id; rename label/table-name (#95)
* feat(databases): migrate to dedicated databases API * feat(datasets): narrow create to sql/query-id; rename label→description, table-name→name * Remove dead upload code from datasets; fix create signatures After the create rework removed --file/--upload-id/--url paths, the upload infrastructure (FileType, detect_from_bytes/path, stdin_redirect_filename, make_progress_bar, do_upload, upload_from_file/stdin, create_from_upload, create_from_url) was left as dead code. Remove it. Also align create_from_query/create_from_saved_query with the new CLI: - `name: &str` (required, was Option<&str>) - `description: Option<&str>` (optional, was required label) - create_dataset builds the body with table_name always set, label only when provided Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: describe datasets as derived views in help text * fix: update error message and unwrap in datasets - datasets::update now references --description/--name (not the old --label/--table-name flags that were renamed in this PR) - replace query_id.unwrap() with unreachable!() to make the clap invariant explicit rather than silently panicking Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: fall back to --name as label when --description omitted on create Without this, omitting --description sent no label to the API, which treats label as required and would return a server-side error. Also corrects the --name help text example from a qualified default.public.my_view to just my_view — the API table_name field expects an unqualified identifier. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor(datasets): rename update() params from label/table_name to description/name Aligns internal parameter names with the renamed CLI flags introduced in this PR. The API body keys (label, table_name) remain unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 17059bd commit 3f1b8ee

3 files changed

Lines changed: 40 additions & 370 deletions

File tree

src/command.rs

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub enum Commands {
88
command: Option<AuthCommands>,
99
},
1010

11-
/// Upload and query Parquet, CSV, and JSON files
11+
/// Derived views — virtual SQL tables built from queries over your data
1212
Datasets {
1313
/// Dataset ID to show details
1414
id: Option<String>,
@@ -453,53 +453,37 @@ pub enum DatasetsCommands {
453453
output: String,
454454
},
455455

456-
/// Create a new dataset from a file, piped stdin, upload ID, or SQL query
456+
/// Create a derived view from a SQL query or saved query
457457
Create {
458-
/// Dataset label (derived from filename if omitted)
458+
/// SQL table name the dataset is addressable as (e.g. my_view)
459459
#[arg(long)]
460-
label: Option<String>,
460+
name: String,
461461

462-
/// Table name (derived from label if omitted)
462+
/// Human-readable display label
463463
#[arg(long)]
464-
table_name: Option<String>,
465-
466-
/// Path to a file to upload (omit to read from stdin)
467-
#[arg(long, conflicts_with_all = ["upload_id", "sql"])]
468-
file: Option<String>,
469-
470-
/// Skip upload and use a pre-existing upload ID directly
471-
#[arg(long, conflicts_with_all = ["file", "sql"])]
472-
upload_id: Option<String>,
473-
474-
/// Source format when using --upload-id (csv, json, parquet)
475-
#[arg(long, default_value = "csv", value_parser = ["csv", "json", "parquet"], requires = "upload_id")]
476-
format: String,
464+
description: Option<String>,
477465

478466
/// SQL query to create the dataset from
479-
#[arg(long, conflicts_with_all = ["file", "upload_id", "query_id", "url"])]
467+
#[arg(long, conflicts_with = "query_id", required_unless_present = "query_id")]
480468
sql: Option<String>,
481469

482470
/// Saved query ID to create the dataset from
483-
#[arg(long, conflicts_with_all = ["file", "upload_id", "sql", "url"])]
471+
#[arg(long, conflicts_with = "sql", required_unless_present = "sql")]
484472
query_id: Option<String>,
485-
486-
/// URL to import data from
487-
#[arg(long, conflicts_with_all = ["file", "upload_id", "sql", "query_id"])]
488-
url: Option<String>,
489473
},
490474

491-
/// Update a dataset's label and/or table name
475+
/// Update a dataset's description and/or name
492476
Update {
493477
/// Dataset ID
494478
id: String,
495479

496480
/// New display label
497481
#[arg(long)]
498-
label: Option<String>,
482+
description: Option<String>,
499483

500484
/// New SQL table name (must be a valid identifier)
501485
#[arg(long)]
502-
table_name: Option<String>,
486+
name: Option<String>,
503487

504488
/// Output format
505489
#[arg(long = "output", short = 'o', default_value = "table", value_parser = ["table", "json", "yaml"])]

0 commit comments

Comments
 (0)