feat(queries,results): scope to database for SDK 0.8.0#204
Conversation
| /// Build an [`Api`] scoped to `database` when the caller passed `--database`, | ||
| /// otherwise the database resolved at construction (`HOTDATA_DATABASE` / | ||
| /// current database). | ||
| fn scoped_api(workspace_id: &str, database: Option<&str>) -> Api { |
There was a problem hiding this comment.
nit: this scoped_api helper is duplicated verbatim in src/commands/queries.rs, and the same match database { Some(db) => api.scoped_to_database(...), None => api } is inlined twice more in src/commands/query.rs (execute and poll). Consider consolidating into a single helper — e.g. an Api::scoped_to_database_opt(self, Option<&str>) on the seam — so all four call sites share one implementation. (not blocking)
There was a problem hiding this comment.
Done in a0e1050 — added Api::scoped_to_database_opt(self, Option<&str>) on the seam and routed all four call sites through it, removing the two duplicated scoped_api helpers and the inlined matches in execute/poll.
There was a problem hiding this comment.
Approving. SDK 0.8.0 database-scoping is applied consistently: the seam forwards X-Database-Id via get_json/get_result_arrow, require_database pre-flights with an actionable hint, and all main.rs call sites were updated. One non-blocking duplication nit left inline.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Updates the CLI to hotdata SDK v0.8.0, which makes results and query runs database-scoped via a required
X-Database-Idheader. Adds a-d/--databaseflag toqueriesandresults, resolves the scope (flag →HOTDATA_DATABASE→ active database) and fails with an actionable hint when none is set instead of leaking the raw server error.