Skip to content
44 changes: 14 additions & 30 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum Commands {

/// Managed databases you create and populate with tables (parquet uploads)
Databases {
/// Database name or connection ID (omit to use a subcommand)
/// Database id or description (omit to use a subcommand)
name_or_id: Option<String>,

/// Workspace ID (defaults to first workspace from login)
Expand Down Expand Up @@ -453,53 +453,37 @@ pub enum DatasetsCommands {
output: String,
},

/// Create a new dataset from a file, piped stdin, upload ID, or SQL query
/// Create a new dataset from a SQL query or saved query
Create {
/// Dataset label (derived from filename if omitted)
/// SQL table name for the dataset
#[arg(long)]
label: Option<String>,
name: String,

/// Table name (derived from label if omitted)
/// Human-readable display label
#[arg(long)]
table_name: Option<String>,

/// Path to a file to upload (omit to read from stdin)
#[arg(long, conflicts_with_all = ["upload_id", "sql"])]
file: Option<String>,

/// Skip upload and use a pre-existing upload ID directly
#[arg(long, conflicts_with_all = ["file", "sql"])]
upload_id: Option<String>,

/// Source format when using --upload-id (csv, json, parquet)
#[arg(long, default_value = "csv", value_parser = ["csv", "json", "parquet"], requires = "upload_id")]
format: String,
description: Option<String>,

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

/// Saved query ID to create the dataset from
#[arg(long, conflicts_with_all = ["file", "upload_id", "sql", "url"])]
#[arg(long, conflicts_with = "sql", required_unless_present = "sql")]
query_id: Option<String>,

/// URL to import data from
#[arg(long, conflicts_with_all = ["file", "upload_id", "sql", "query_id"])]
url: Option<String>,
},

/// Update a dataset's label and/or table name
/// Update a dataset's description and/or name
Update {
/// Dataset ID
id: String,

/// New display label
#[arg(long)]
label: Option<String>,
description: Option<String>,

/// New SQL table name (must be a valid identifier)
#[arg(long)]
table_name: Option<String>,
name: Option<String>,
Comment thread
eddietejeda marked this conversation as resolved.
Outdated

/// Output format
#[arg(long = "output", short = 'o', default_value = "table", value_parser = ["table", "json", "yaml"])]
Expand Down Expand Up @@ -557,15 +541,15 @@ pub enum DatabasesCommands {

/// Create a new managed database
Create {
/// Database name (used as the connection name in SQL: `name.schema.table`)
/// Optional display label (not unique, not an identifier — databases are addressed by id)
#[arg(long)]
name: String,
description: Option<String>,

/// Schema for tables declared at create time (default: public)
#[arg(long, default_value = "public")]
schema: String,

/// Table to declare up front (repeatable). Required before load on current API.
/// Table to declare up front (repeatable)
#[arg(long = "table")]
tables: Vec<String>,

Expand Down
Loading
Loading