AGENT SKILL

databricks-cli-sdk-operations

Operate a Databricks workspace with the current Databricks CLI (Go-based, version 0.205 or later), the Databricks SDK for Python, and the Databricks REST API 2.0. Use when authenticating to Databricks, managing config profiles, inspecting clusters, jobs, or workspace files, scripting with databricks-sdk, calling /api/2.0 endpoints directly, handling pagination, or troubleshooting Databricks CLI errors.

License 许可
Apache-2.0
所属仓库
cwik-tech/octopus
最近更新
2026-10-27
Stars
★ 0
Forks
0

01 前言 Front Matter

name
databricks-cli-sdk-operations
description
Operate a Databricks workspace with the current Databricks CLI (Go-based, version 0.205 or later), the Databricks SDK for Python, and the Databricks REST API 2.0. Use when authenticating to Databricks, managing config profiles, inspecting clusters, jobs, or workspace files, scripting with databricks-sdk, calling /api/2.0 endpoints directly, handling pagination, or troubleshooting Databricks CLI errors.

03 SKILL.md 正文

Databricks CLI and SDK Operations

Outcome

Run authenticated, least-privilege Databricks operations from the CLI, Python SDK, or REST API, with verified versions, predictable pagination and error handling, and mutating actions gated on approval.

Setup

  1. Verify the current CLI, not the legacy Python CLI: databricks --version must report 0.205 or later. Install or upgrade per the docs; on macOS brew install databricks or brew upgrade databricks.
  2. Authenticate with OAuth user login (preferred, no stored secret): databricks auth login --host https://<workspace-host> creates a profile in ~/.databrickscfg. For automation use an OAuth service principal: set DATABRICKS_HOST, DATABRICKS_CLIENT_ID, DATABRICKS_CLIENT_SECRET from the environment or a secret store. Never write tokens, client secrets, or PATs into files, prompts, logs, or artifacts; reference env vars.
  3. Select profiles explicitly: databricks --profile prod workspace list / or export DATABRICKS_CONFIG_PROFILE=prod. Confirm identity and target before any change: databricks current-user me --profile prod and check the workspace URL printed.
  4. For the Python SDK, require a recent databricks-sdk (pip show databricks-sdk); it reads the same env vars and ~/.databrickscfg profiles.

Core command patterns

Read-only first; the same patterns apply to mutating calls after approval.

  • Workspace: databricks workspace list /Users (add --recursive for a tree), databricks workspace export /path/notebook -o out.ipynb.
  • Clusters: databricks clusters list --output json, databricks clusters get <cluster-id>.
  • Jobs: databricks jobs list --output json, databricks jobs get <job-id>, databricks jobs run-now --job-id <id>.
  • REST fallback for endpoints without a CLI wrapper: curl -H "Authorization: Bearer $(databricks auth token --profile prod | jq -r .access_token)" https://<workspace-host>/api/2.0/clusters/list. CLI command and flag names mirror the REST operation names; check the CLI commands reference before scripting.
  • Python SDK: from databricks.sdk import WorkspaceClient; w = WorkspaceClient(profile="prod"), then for c in w.clusters.list(): ... — SDK list calls auto-paginate.

Pagination and errors

  • CLI list commands paginate automatically; the REST API returns next_page_token (or has_more with offset on older endpoints). When scripting against REST, loop until no next_page_token; never assume one page.
  • Use --output json plus jq for parsing. Diagnose failures with --debug for request/response traces — the trace can contain headers, so do not paste it into artifacts.
  • Map HTTP status to action: 401/403 = auth or permission (re-run databricks auth login or check the token's workspace), 404 = wrong workspace or ID, 429 = back off and retry with jitter.

Permissions and safety

  • Grant least privilege: workspace access entitlement, CAN USE on clusters and CAN MANAGE RUN or CAN MANAGE on jobs only where needed. Automation uses a service principal, never a personal account.
  • Read-only operations (list, get, export, current-user) need no approval. Mutating operations (create, update, run-now, start, restart, delete) require a written plan and explicit user approval. Destructive operations (delete, reset, cluster permanent termination) additionally require naming the exact resource ID and a stated rollback path.
  • Workflow: inspect (read-only) → plan (proposed calls with IDs and diffs) → execute → verify (re-read the object or run state) → rollback or roll forward.

Troubleshooting

  • Error: cannot configure default credentials: no auth configured; run databricks auth login --host <url> or set the env vars for your auth type.
  • Commands hit the wrong workspace: a profile or DATABRICKS_HOST from a parent shell overrides intent; check databricks auth env --profile <name> and unset stray env vars.
  • 403 on a valid token: the identity lacks workspace entitlement or object ACL; verify with databricks current-user me and check object-level permissions.
  • Legacy CLI behavior (databricks configure --token, different flags): you are on CLI 0.18 or older; upgrade to 0.205+.
  • SDK raises NotFound or PermissionDenied from databricks.sdk.errors: catch the mapped exception classes, not generic Exception.

References

Shared resources

Load only if the task needs them; the skill is self-contained without them.

  • ../../references/security-control-baseline.md

Completion check

databricks current-user me returns the intended identity in the intended workspace, every mutating call was approved and re-read to confirm the resulting state, and no secret appears in any file, prompt, log, or artifact.

04 同仓库更多 Skills

cwik-tech
cwik-tech/octopus

twenty-year-land-plan

Apply the Bren discipline of evaluating every land and development decision on a twenty-year horizon, with a comprehensive plan for how the land, the community, and the surrounding public infrastructure evolve together. Deals optimized for a five-year exit are structurally different from deals that compound across generations; insist on knowing which kind you are making. Use when evaluating land, entitlements, master-planned development, or phasing decisions, and when separating five-year exit deals from generational holds.

★ 0
cwik-tech
cwik-tech/octopus

thematic-gut-check

Apply the Gray discipline of identifying the structural theme behind every real estate deal, testing where that theme sits in its capital-flow lifecycle, and insisting that deals without a named theme — or deals late in a crowded theme — clear a higher bar. A mediocre deal in a strong theme usually beats a clever deal in a weak one. Use when naming the structural thesis behind a deal, judging whether that theme is early or crowded, and setting the bar the deal must clear.

★ 0
cwik-tech
cwik-tech/octopus

supply-pipeline-gut-check

Apply the Zell discipline of grounding every real estate thesis in the local supply pipeline. Demand counts over adjectives — units under construction, units permitted, units proposed — and convert them into a forward absorption schedule. A deal that ignores the pipeline is a bet on a market you have not actually studied. Use when validating a market thesis, forecasting absorption and rent growth, or counting units under construction, permitted, and proposed.

★ 0
cwik-tech
cwik-tech/octopus

ruin-scenario-mapping

Apply the Taleb discipline of identifying, for every real estate deal, the specific chain of events that produces ruin — permanent, unrecoverable capital loss — and verifying that no single such chain has non-trivial probability. Deals with any plausible ruin path must be restructured or abandoned. Use when sizing leverage, testing refinancing, covenant, and liquidity risk, or checking whether any single failure chain can permanently wipe out the position.

★ 0
cwik-tech
cwik-tech/octopus

revenue-cost-architecture

Design a venture's revenue streams, pricing logic, cost structure, and unit economics so the business model has a coherent theory of value capture, not just value creation. Use after the value proposition and customer segment are set and before financial projections, when choosing a pricing model, calculating contribution margin or CAC payback, or checking whether the unit economics hold at scale.

★ 0
cwik-tech
cwik-tech/octopus

replacement-cost-stress-test

Apply the Buffett discipline of pricing every real estate asset against the cost to rebuild it from scratch. The ratio of purchase price to replacement cost sets a ceiling on long-run downside: below replacement cost, new supply cannot profitably undercut you; at or above it, you are buying a liability disguised as an asset. Use when setting a purchase price, judging downside protection, or testing how exposed an asset is to newly built competing supply.

★ 0