|
| 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. |
0 commit comments