Skip to content

Add Pipelines Show Command - #6033

Open
tanishgupta-db wants to merge 5 commits into
databricks:mainfrom
tanishgupta-db:preview-datasets
Open

Add Pipelines Show Command#6033
tanishgupta-db wants to merge 5 commits into
databricks:mainfrom
tanishgupta-db:preview-datasets

Conversation

@tanishgupta-db

@tanishgupta-db tanishgupta-db commented Jul 22, 2026

Copy link
Copy Markdown

Changes

Adds databricks pipelines show <catalog.schema.table> command: shows a table's columns and sample data (or --output json). Runs SELECT * FROM <table> LIMIT n on a SQL warehouse. The warehouse is taken from --warehouse-id, DATABRICKS_WAREHOUSE_ID (env set), the workspace default, or picked.

Also adds renderStaticWithTruncation in tableview for detecting terminal width and rendering a formatted table

Why

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 pipelines command group.

Tests

  • Unit tests and Acceptance tests

E2E testing:

Screen.Recording.2026-07-23.at.11.05.36.PM.mov

@tanishgupta-db
tanishgupta-db marked this pull request as ready for review July 23, 2026 04:47
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/pipelines/ - needs approval

8 files changed
Suggested: @kanterov
Also eligible: @jefferycheng1, @lennartkats-db

/cmd/pipelines/ - needs approval

7 files changed
Suggested: @kanterov
Also eligible: @jefferycheng1, @lennartkats-db

General files (require maintainer)

Files: NOTICE, go.mod
Based on git history:

  • @pietern -- recent work in cmd/pipelines/, ./

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@tanishgupta-db tanishgupta-db changed the title preview-datasets v1 Add Pipelines Show Command Jul 24, 2026
=== invalid table name

>>> [CLI] pipelines show people
Error: invalid table name "people": expected catalog.schema.table or schema.table

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default 100 seems high, how about 10 instead?


=== json output

>>> [CLI] pipelines show main.default.people --output json

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if a user passes in a table name that already has backticks, like "main.default.people"?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread libs/tableview/static.go Outdated
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))

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.

Shall we do something like

if len(rows) == 1 {
    fmt.Fprintln(out, "1 row")
} else {
    fmt.Fprintf(out, "%d rows\n", len(rows))
}

Comment thread libs/tableview/static.go Outdated
@@ -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

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.

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

@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6033
  • Commit SHA: 14eb19734ca95235827e4820e98407b3578ee361

Checks will be approved automatically on success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants