Skip to content

Commit 9e7d7d7

Browse files
authored
Add databricks quickstart command (#5464)
## Why Someone running the Databricks CLI for the first time has no built-in starting point. They have to go find docs, work out auth and profiles, and guess at how to actually build something. `databricks quickstart` gives them a short, opinionated introduction right in the terminal. It serves coding agents too: an agent with no Databricks skill loaded can run `databricks quickstart` to orient itself (auth, profiles, building with Asset Bundles) before attempting work. ## Changes Before: there was no `quickstart` command. Now: `databricks quickstart` prints a short introduction covering authentication, profile selection, building with Databricks Asset Bundles, and where to go next. - New `cmd/quickstart` package, registered in `cmd/cmd.go`. - The text lives in two embedded markdown files: `quickstart-human.md` (the default) and `quickstart-agent.md` (denser and agent-oriented; it is also the `databricks-quickstart` skill, so its YAML frontmatter is stripped before printing). - Audience detection: interactive terminals get the human guide, non-interactive callers (coding agents, scripts, CI) get the agent version. It uses `cmdio.IsPromptSupported` and is deliberately simple for now, leaving room for smarter agent detection later. - Output is written to stdout so it can be piped or captured. ## Test plan - [x] Unit tests for the human/agent selection and frontmatter stripping (`cmd/quickstart/quickstart_test.go`). - [x] Acceptance test for the rendered output (`acceptance/quickstart`); root-help golden updated to include the new command. - [x] `./task fmt-q`, `./task lint-q`, and `./task checks` all clean. - [x] Built the binary and ran `databricks quickstart` non-interactively to confirm the agent version prints with frontmatter stripped. This pull request and its description were written by Isaac. --------- Signed-off-by: simonfaltum <simon.faltum@databricks.com>
1 parent a934f8c commit 9e7d7d7

11 files changed

Lines changed: 393 additions & 0 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Notable Changes
66

77
### CLI
8+
* Added the `databricks quickstart` command, a short introduction to the CLI that prints a human-friendly guide interactively and an agent-oriented version when run non-interactively ([#5464](https://github.com/databricks/cli/pull/5464)).
89

910
### Bundles
1011
* Set the default `data_security_mode` to `DATA_SECURITY_MODE_AUTO` in bundle templates ([#5452](https://github.com/databricks/cli/pull/5452)).

acceptance/help/output.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Additional Commands:
177177
configure Configure authentication
178178
help Help about any command
179179
labs Manage Databricks Labs installations
180+
quickstart Print an introduction to the Databricks CLI
180181
version Retrieve information about the current version of this CLI
181182

182183
Flags:

acceptance/quickstart/out.test.toml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

acceptance/quickstart/output.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Databricks Quickstart
2+
3+
The `databricks` CLI wraps the public Databricks REST API — there's a command for essentially every API endpoint, so almost any Databricks task can be driven from here. If something looks unsupported, it's almost always a command you haven't found yet, not a real gap. The headline workflow: build durable resources as code with **Databricks Asset Bundles (DABs)** and ship them with `databricks bundle deploy` (see Build and deploy below).
4+
5+
## Golden rules
6+
7+
- **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and install the matching skill (below). Almost everything is reachable through the CLI.
8+
- **Build with bundles.** For anything durable — jobs, pipelines, dashboards, apps — define it as code in a Databricks Asset Bundle (DABs) and ship with `databricks bundle deploy`, not one-off API calls.
9+
- **Pick the profile deliberately.** Run `databricks auth profiles`. If only one profile exists, use it. If one is already set as the default (via `databricks auth switch`), assume that one — you can confirm if unsure. Otherwise, show the user the profiles with their workspace URLs and let them choose. Don't invent profile names.
10+
- **Always pass `--profile <name>`.** Each Bash command runs in its own shell, so a separate `export DATABRICKS_CONFIG_PROFILE=...` line does NOT persist. Use the flag, or chain with `&&`.
11+
- **OAuth, never PAT.** Authenticate with `databricks auth login`, not personal access tokens.
12+
13+
## Step 1 — Authenticate
14+
15+
```bash
16+
databricks auth profiles # already set up? lists profiles + validity
17+
databricks auth login --profile <name> # if not — opens login.databricks.com to pick a workspace
18+
```
19+
20+
No host needed: without `--host`, login opens login.databricks.com and the user picks a workspace in the browser. Only pass `--host <url>` if the user already gave you a specific workspace URL. Always pass a descriptive `--profile <name>` (e.g. `dev-aws`, `prod-azure`) so you can target it reliably afterward — ask the user for the name rather than inventing one.
21+
22+
## Step 2 — Verify
23+
24+
```bash
25+
databricks current-user me --profile <name>
26+
```
27+
28+
## Build and deploy with Asset Bundles (DABs)
29+
30+
**DABs are the standard, recommended way to build on Databricks.** A bundle is a project with a `databricks.yml` that declares your resources (jobs, pipelines, dashboards, apps) and its targets (e.g. dev, prod) — one project, one deploy, every resource type:
31+
32+
```bash
33+
databricks bundle init # scaffold a project from a template
34+
databricks bundle validate # check the config
35+
databricks bundle deploy -t dev # deploy everything to a target (dev, prod, ...)
36+
databricks bundle run <resource> -t dev # run a job or pipeline
37+
```
38+
39+
Read the `databricks-dabs` skill for bundle structure, resource schemas, and multi-target setup.
40+
41+
**Databricks Apps** (full-stack TypeScript + React via AppKit) build on bundles too, with a dedicated scaffolder — see `databricks-apps`:
42+
43+
```bash
44+
databricks apps init # scaffold an AppKit app (generates the bundle for you)
45+
databricks apps deploy # deploy it to the workspace
46+
databricks apps run-local # develop locally (or `dev-remote` against the workspace)
47+
```
48+
49+
## Common commands
50+
51+
```bash
52+
databricks jobs list --profile <name>
53+
databricks pipelines list --profile <name>
54+
databricks apps list --profile <name>
55+
databricks warehouses list --profile <name>
56+
57+
# Unity Catalog data uses POSITIONAL args, NOT flags:
58+
databricks catalogs list --profile <name>
59+
databricks schemas list <catalog> --profile <name>
60+
databricks tables list <catalog> <schema> --profile <name>
61+
```
62+
63+
Unsure of a command's shape? Run `databricks <command> --help`.
64+
65+
## Install skills for the task
66+
67+
Skills give you Databricks-specific patterns so you build resources correctly instead of guessing. They install into your coding agent (auto-detected):
68+
69+
```bash
70+
databricks aitools install # stable skills
71+
databricks aitools install --experimental # broader coverage: more areas, lower quality bar
72+
databricks aitools list # available + installed skills — check this for the latest
73+
```
74+
75+
The set evolves, so run `databricks aitools list` rather than relying on a fixed list. Common ones: `databricks-core` (CLI/auth), `databricks-jobs`, `databricks-pipelines`, `databricks-dabs` (deploy as code), `databricks-apps`. Experimental skills reach further (Unity Catalog, vector search, dashboards, AI functions, and more) — worth a look depending on the prompt.
76+
77+
## Explore data
78+
79+
Use the built-in tools instead of guessing SQL or navigating by hand:
80+
81+
```bash
82+
databricks experimental aitools tools discover-schema <catalog>.<schema>.<table> --profile <name>
83+
databricks experimental aitools tools query "SELECT * FROM <table> LIMIT 10" --profile <name>
84+
```
85+
86+
## When you get stuck
87+
88+
Re-read `databricks <group> --help`, install the matching skill, and check https://docs.databricks.com. If you truly can't do something yourself, tell the user how they can — don't tell them Databricks can't.

acceptance/quickstart/script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
$CLI quickstart

cmd/cmd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/databricks/cli/cmd/fs"
2020
"github.com/databricks/cli/cmd/labs"
2121
"github.com/databricks/cli/cmd/pipelines"
22+
"github.com/databricks/cli/cmd/quickstart"
2223
"github.com/databricks/cli/cmd/root"
2324
"github.com/databricks/cli/cmd/selftest"
2425
"github.com/databricks/cli/cmd/sync"
@@ -123,6 +124,7 @@ func New(ctx context.Context) *cobra.Command {
123124
cli.AddCommand(labs.New(ctx))
124125
cli.AddCommand(sync.New())
125126
cli.AddCommand(version.New())
127+
cli.AddCommand(quickstart.New())
126128
cli.AddCommand(selftest.New())
127129
cli.AddCommand(ssh.New())
128130

cmd/quickstart/.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# These markdown files are embedded into the binary with go:embed and their
2+
# newlines are semantically important: stripFrontmatter matches an LF fence
3+
# ("---\n"), so an extra \r on Windows would leave the frontmatter unstripped.
4+
# Always check them out with \n so the embedded content is identical on every
5+
# platform.
6+
*.md text eol=lf

cmd/quickstart/quickstart-agent.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
name: databricks-quickstart
3+
description: First-contact orientation for the Databricks CLI when no Databricks skill is loaded. Covers OAuth auth, profile selection, command discovery, and installing the right skill for the task. Read this before attempting any Databricks work.
4+
---
5+
6+
# Databricks Quickstart
7+
8+
The `databricks` CLI wraps the public Databricks REST API — there's a command for essentially every API endpoint, so almost any Databricks task can be driven from here. If something looks unsupported, it's almost always a command you haven't found yet, not a real gap. The headline workflow: build durable resources as code with **Databricks Asset Bundles (DABs)** and ship them with `databricks bundle deploy` (see Build and deploy below).
9+
10+
## Golden rules
11+
12+
- **Reason, don't refuse.** Before telling the user something can't be done, run `databricks <group> --help` and install the matching skill (below). Almost everything is reachable through the CLI.
13+
- **Build with bundles.** For anything durable — jobs, pipelines, dashboards, apps — define it as code in a Databricks Asset Bundle (DABs) and ship with `databricks bundle deploy`, not one-off API calls.
14+
- **Pick the profile deliberately.** Run `databricks auth profiles`. If only one profile exists, use it. If one is already set as the default (via `databricks auth switch`), assume that one — you can confirm if unsure. Otherwise, show the user the profiles with their workspace URLs and let them choose. Don't invent profile names.
15+
- **Always pass `--profile <name>`.** Each Bash command runs in its own shell, so a separate `export DATABRICKS_CONFIG_PROFILE=...` line does NOT persist. Use the flag, or chain with `&&`.
16+
- **OAuth, never PAT.** Authenticate with `databricks auth login`, not personal access tokens.
17+
18+
## Step 1 — Authenticate
19+
20+
```bash
21+
databricks auth profiles # already set up? lists profiles + validity
22+
databricks auth login --profile <name> # if not — opens login.databricks.com to pick a workspace
23+
```
24+
25+
No host needed: without `--host`, login opens login.databricks.com and the user picks a workspace in the browser. Only pass `--host <url>` if the user already gave you a specific workspace URL. Always pass a descriptive `--profile <name>` (e.g. `dev-aws`, `prod-azure`) so you can target it reliably afterward — ask the user for the name rather than inventing one.
26+
27+
## Step 2 — Verify
28+
29+
```bash
30+
databricks current-user me --profile <name>
31+
```
32+
33+
## Build and deploy with Asset Bundles (DABs)
34+
35+
**DABs are the standard, recommended way to build on Databricks.** A bundle is a project with a `databricks.yml` that declares your resources (jobs, pipelines, dashboards, apps) and its targets (e.g. dev, prod) — one project, one deploy, every resource type:
36+
37+
```bash
38+
databricks bundle init # scaffold a project from a template
39+
databricks bundle validate # check the config
40+
databricks bundle deploy -t dev # deploy everything to a target (dev, prod, ...)
41+
databricks bundle run <resource> -t dev # run a job or pipeline
42+
```
43+
44+
Read the `databricks-dabs` skill for bundle structure, resource schemas, and multi-target setup.
45+
46+
**Databricks Apps** (full-stack TypeScript + React via AppKit) build on bundles too, with a dedicated scaffolder — see `databricks-apps`:
47+
48+
```bash
49+
databricks apps init # scaffold an AppKit app (generates the bundle for you)
50+
databricks apps deploy # deploy it to the workspace
51+
databricks apps run-local # develop locally (or `dev-remote` against the workspace)
52+
```
53+
54+
## Common commands
55+
56+
```bash
57+
databricks jobs list --profile <name>
58+
databricks pipelines list --profile <name>
59+
databricks apps list --profile <name>
60+
databricks warehouses list --profile <name>
61+
62+
# Unity Catalog data uses POSITIONAL args, NOT flags:
63+
databricks catalogs list --profile <name>
64+
databricks schemas list <catalog> --profile <name>
65+
databricks tables list <catalog> <schema> --profile <name>
66+
```
67+
68+
Unsure of a command's shape? Run `databricks <command> --help`.
69+
70+
## Install skills for the task
71+
72+
Skills give you Databricks-specific patterns so you build resources correctly instead of guessing. They install into your coding agent (auto-detected):
73+
74+
```bash
75+
databricks aitools install # stable skills
76+
databricks aitools install --experimental # broader coverage: more areas, lower quality bar
77+
databricks aitools list # available + installed skills — check this for the latest
78+
```
79+
80+
The set evolves, so run `databricks aitools list` rather than relying on a fixed list. Common ones: `databricks-core` (CLI/auth), `databricks-jobs`, `databricks-pipelines`, `databricks-dabs` (deploy as code), `databricks-apps`. Experimental skills reach further (Unity Catalog, vector search, dashboards, AI functions, and more) — worth a look depending on the prompt.
81+
82+
## Explore data
83+
84+
Use the built-in tools instead of guessing SQL or navigating by hand:
85+
86+
```bash
87+
databricks experimental aitools tools discover-schema <catalog>.<schema>.<table> --profile <name>
88+
databricks experimental aitools tools query "SELECT * FROM <table> LIMIT 10" --profile <name>
89+
```
90+
91+
## When you get stuck
92+
93+
Re-read `databricks <group> --help`, install the matching skill, and check https://docs.databricks.com. If you truly can't do something yourself, tell the user how they can — don't tell them Databricks can't.

cmd/quickstart/quickstart-human.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Welcome to Databricks
2+
3+
Databricks is one place for all your data and AI work: store and govern data, run SQL and notebooks, build pipelines and dashboards, train and serve models, and ship apps. No stitching together separate tools.
4+
5+
This guide takes you from zero to your first command.
6+
7+
## What you need
8+
9+
A **workspace** — your Databricks home, at a URL like `https://your-company.cloud.databricks.com`. No access yet? Sign up for a free trial at https://www.databricks.com (Databricks Free Edition is great for learning). You've already got the CLI — it's how you're reading this.
10+
11+
## A few concepts (the 30-second version)
12+
13+
- **Workspace** — the environment you log into. Notebooks, jobs, dashboards, and data all live here.
14+
- **Unity Catalog** — how Databricks governs your data. Tables are named in three parts: `catalog.schema.table` (think folder → subfolder → table).
15+
- **Compute** — where your code runs. *SQL warehouses* run SQL; *clusters* and *serverless* run notebooks and jobs.
16+
- **Profile** — a saved connection to a workspace on your machine, so you don't re-enter credentials each time.
17+
18+
## Step 1 — Connect to your workspace
19+
20+
```bash
21+
databricks auth login
22+
```
23+
This opens **login.databricks.com** in your browser. Sign in, pick the workspace you want, and you're connected — no URL to look up. The CLI saves the connection as a *profile*; if it's your only workspace, press Enter to accept the suggested name and every command will use it automatically. Run `databricks auth login` again any time to add another workspace.
24+
25+
Already know your workspace URL? Go straight to it: `databricks auth login --host https://your-company.cloud.databricks.com --profile my-workspace`.
26+
27+
## Step 2 — Try it out
28+
29+
```bash
30+
databricks current-user me # who am I?
31+
databricks catalogs list # what data can I see?
32+
databricks jobs list # my jobs
33+
```
34+
To see everything a command can do, add `--help` — for example, `databricks jobs --help`.
35+
36+
Got more than one workspace? Name each at login (`databricks auth login --profile prod`), then target it with `--profile`, e.g. `databricks jobs list --profile prod`.
37+
38+
💡 **Tip:** turn on tab-completion so you can `Tab` through commands and flags: `databricks completion install`.
39+
40+
## Step 3 — Build something
41+
42+
The standard way to build on Databricks is **Databricks Asset Bundles (DABs)** — your jobs, pipelines, dashboards, and apps defined as code in one project, shipped with one command:
43+
44+
```bash
45+
databricks bundle init # start from a template
46+
databricks bundle validate # check it
47+
databricks bundle deploy -t dev # ship it to your workspace
48+
databricks bundle run <name> -t dev # run a job or pipeline
49+
```
50+
51+
Want a **full-stack app**? AppKit scaffolds one in TypeScript + React:
52+
53+
```bash
54+
databricks apps init # scaffold the app
55+
databricks apps deploy # deploy it to your workspace
56+
databricks apps run-local # develop locally (or dev-remote)
57+
```
58+
59+
## Where to go next
60+
61+
- **Explore your data** — browse catalogs, schemas, and tables, or query them from the workspace UI.
62+
- **More to build** — Lakeflow Jobs (orchestration), Lakeflow Pipelines (ETL), AI/BI Dashboards, and Model Serving.
63+
- **Using an AI coding assistant?** Install the Databricks skills so it knows these patterns: `databricks aitools install`.
64+
65+
📚 Full docs: https://docs.databricks.com • CLI reference: https://docs.databricks.com/dev-tools/cli
66+
67+
Welcome aboard.

cmd/quickstart/quickstart.go

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package quickstart
2+
3+
import (
4+
_ "embed"
5+
"fmt"
6+
"strings"
7+
8+
"github.com/databricks/cli/cmd/root"
9+
"github.com/databricks/cli/libs/cmdio"
10+
"github.com/spf13/cobra"
11+
)
12+
13+
// humanQuickstart is the friendly, default introduction shown to people.
14+
//
15+
//go:embed quickstart-human.md
16+
var humanQuickstart string
17+
18+
// agentQuickstart is the denser, agent-oriented version. It is also the
19+
// `databricks-quickstart` skill, so it carries skill frontmatter that
20+
// stripFrontmatter removes before printing.
21+
//
22+
//go:embed quickstart-agent.md
23+
var agentQuickstart string
24+
25+
func New() *cobra.Command {
26+
cmd := &cobra.Command{
27+
Use: "quickstart",
28+
Args: root.NoArgs,
29+
Short: "Print an introduction to the Databricks CLI",
30+
Long: `Print a short introduction to the Databricks CLI: authentication, profiles,
31+
building with Databricks Asset Bundles, and where to go next.
32+
33+
Prints a human-friendly guide by default. When stdout is not an interactive
34+
terminal (for example, when a coding agent runs the command), it prints a
35+
denser, agent-oriented version instead.`,
36+
}
37+
38+
cmd.RunE = func(cmd *cobra.Command, args []string) error {
39+
content := quickstartFor(cmdio.IsPromptSupported(cmd.Context()))
40+
_, err := fmt.Fprintln(cmd.OutOrStdout(), content)
41+
return err
42+
}
43+
44+
return cmd
45+
}
46+
47+
// quickstartFor returns the quickstart text for the caller. Interactive
48+
// terminals (people) get the friendly guide; non-interactive callers (coding
49+
// agents, scripts, CI) get the agent-oriented version. The detection is
50+
// intentionally simple for now and can grow more precise later.
51+
func quickstartFor(interactive bool) string {
52+
if interactive {
53+
return strings.TrimRight(humanQuickstart, "\n")
54+
}
55+
return stripFrontmatter(agentQuickstart)
56+
}
57+
58+
// stripFrontmatter removes a leading YAML frontmatter block ("---\n...\n---\n")
59+
// so the printed output starts at the document heading rather than the skill
60+
// metadata. Input without frontmatter is returned unchanged (trailing newlines
61+
// trimmed). Fprintln re-adds a single trailing newline.
62+
func stripFrontmatter(s string) string {
63+
const fence = "---\n"
64+
if !strings.HasPrefix(s, fence) {
65+
return strings.TrimRight(s, "\n")
66+
}
67+
rest := s[len(fence):]
68+
_, body, found := strings.Cut(rest, "\n"+fence)
69+
if !found {
70+
return strings.TrimRight(s, "\n")
71+
}
72+
return strings.TrimRight(strings.TrimLeft(body, "\n"), "\n")
73+
}

0 commit comments

Comments
 (0)