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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ path = "src/main.rs"
# behind a shared multi-thread tokio runtime. The `arrow` feature backs result
# decode; `upload_file` runs the presigned direct-to-storage upload flow
# (see src/sdk.rs::Api::upload).
hotdata = { version = "0.8.0", features = ["arrow"] }
hotdata = { version = "0.8.1", features = ["arrow"] }
# Shared multi-thread runtime for the sync wrapper; block_on is called
# concurrently from rayon worker threads (see src/indexes.rs). The presigned
# upload (src/sdk.rs::Api::upload) drives the SDK's async `upload_file` on this
Expand Down
22 changes: 19 additions & 3 deletions src/commands/databases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ struct DatabaseSummary {
name: Option<String>,
#[serde(default)]
default_catalog: Option<String>,
#[serde(default)]
created_at: Option<String>,
}

/// CLI output shape for `databases get`. A curated, stably-ordered view mapped
Expand All @@ -275,6 +277,8 @@ pub struct Database {
#[serde(default)]
pub expires_at: Option<String>,
#[serde(default)]
pub created_at: Option<String>,
#[serde(default)]
attachments: Vec<DatabaseAttachment>,
}

Expand Down Expand Up @@ -347,6 +351,7 @@ impl From<hotdata::models::DatabaseDetailResponse> for Database {
default_catalog: Some(d.default_catalog),
default_connection_id: d.default_connection_id,
expires_at: d.expires_at.flatten(),
created_at: d.created_at.flatten(),
attachments: d
.attachments
.into_iter()
Expand All @@ -360,12 +365,12 @@ impl From<hotdata::models::DatabaseDetailResponse> for Database {
}

impl From<hotdata::models::DatabaseSummary> for DatabaseSummary {
/// Map the SDK's typed summary into the CLI's list-row output shape.
fn from(s: hotdata::models::DatabaseSummary) -> Self {

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: this drops the existing doc comment /// Map the SDK's typed summary into the CLI's list-row output shape. for no apparent reason. The sibling From<DatabaseDetailResponse> impl above still keeps its doc comment, so removing this one makes the two inconsistent. (not blocking)

DatabaseSummary {
id: s.id,
name: s.name.flatten(),
default_catalog: Some(s.default_catalog),
created_at: s.created_at.flatten(),
}
}
}
Expand All @@ -386,7 +391,7 @@ pub(crate) fn get_database(api: &Api, id: &str) -> Result<Database, ApiError> {
/// up worker" hint instead of an unexplained pause — `databases list` is a
/// common first command against an idle workspace.
fn list_database_summaries(api: &Api) -> Result<Vec<DatabaseSummary>, ApiError> {
block_with_wakeup(api, "Loading databases…", api.client().databases().list())
block_with_wakeup(api, "Loading databases...", api.client().databases().list())

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: this swaps the Unicode ellipsis … for three dots ..., which is unrelated to the created_at feature and introduces inconsistency within this file — other spinners here still use … (e.g. line 1317 "Deleting database…"). Suggest keeping … to match the surrounding code. (not blocking)

.map(|r| r.databases.into_iter().map(DatabaseSummary::from).collect())
}

Expand Down Expand Up @@ -818,10 +823,14 @@ pub fn list(workspace_id: &str, format: &str) {
marker.to_string(),
d.id.clone(),
d.name.as_deref().unwrap_or("-").to_string(),
d.created_at
.as_deref()
.map(crate::util::format_date)
.unwrap_or_else(|| "-".to_string()),
]
})
.collect();
crate::output::table::print(&["", "ID", "NAME"], &rows);
crate::output::table::print(&["", "ID", "NAME", "CREATED"], &rows);
}
}
_ => unreachable!(),
Expand All @@ -845,6 +854,13 @@ pub fn get(workspace_id: &str, id_or_name: &str, format: &str) {
if let Some(c) = &db.default_catalog {
println!("{}{}", label("catalog:"), c.clone().cyan());
}
if let Some(ts) = &db.created_at {
println!(
"{}{}",
label("created_at:"),
crate::util::format_date(ts).dark_grey()
);
}
println!(
"{}{}",
label("default_connection_id:"),
Expand Down
Loading