Add Pipelines Show Command - #6033
Conversation
Approval status: pending
|
f4c46a9 to
ef8b086
Compare
ef8b086 to
a77e404
Compare
| === invalid table name | ||
|
|
||
| >>> [CLI] pipelines show people | ||
| Error: invalid table name "people": expected catalog.schema.table or schema.table |
There was a problem hiding this comment.
nit: can you specify that the three-part name is necessary for UC tables and two-part for HMS?
|
|
||
| Flags: | ||
| -h, --help help for show | ||
| -n, --limit int Maximum number of rows to fetch. (default 100) |
There was a problem hiding this comment.
default 100 seems high, how about 10 instead?
|
|
||
| === json output | ||
|
|
||
| >>> [CLI] pipelines show main.default.people --output json |
There was a problem hiding this comment.
What happens if a user passes in a table name that already has backticks, like "main.default.people"?
There was a problem hiding this comment.
I assume the backticks are literal characters in the name (e.g. an MV whose catalog is named main). To address that correctly I double internal backticks, so such names are reachable.
if the user meant "main.default.people" and pre-quoted, they'll see a not-found error.
| if cropped { | ||
| fmt.Fprintln(out, cmdio.Faint(ctx, fmt.Sprintf("(showing %d of %d columns)", shown, n))) | ||
| } | ||
| fmt.Fprintf(out, "%d rows\n", len(rows)) |
There was a problem hiding this comment.
Shall we do something like
if len(rows) == 1 {
fmt.Fprintln(out, "1 row")
} else {
fmt.Fprintf(out, "%d rows\n", len(rows))
}
| @@ -0,0 +1,178 @@ | |||
| // This file is the static, terminal-width-aware rendering path, used for | |||
| // non-interactive output; the interactive browser lives in tableview.go. | |||
| package tableview | |||
There was a problem hiding this comment.
I think you can use cmdio.RenderWithTemplate, generate the template based on the data you receive from SQL query and pass it to RenderWithTemplate
Thus you can reuse existing rendering code and get all of the benefits for free
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Changes
Adds
databricks pipelines show <catalog.schema.table>command: shows a table's columns and sample data (or--output json). RunsSELECT * FROM <table> LIMIT non a SQL warehouse. The warehouse is taken from--warehouse-id,DATABRICKS_WAREHOUSE_ID(env set), the workspace default, or picked.Also adds
renderStaticWithTruncationin tableview for detecting terminal width and rendering a formatted tableWhy
Users want a quick look at the data and schema of a dataset quickly without leaving the terminal. Mirrors the Catalog Explorer "Sample Data" experience for the CLI. Lives under the
pipelinescommand group.Tests
E2E testing:
Screen.Recording.2026-07-23.at.11.05.36.PM.mov