databricks-core

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Databricks

Databricks

Core skill for Databricks CLI, authentication, and data exploration.
Databricks CLI、身份认证以及数据探查的核心技能。

Product Skills

产品技能

For specific products, use dedicated skills:
  • databricks-jobs - Lakeflow Jobs development and deployment
  • databricks-pipelines - Lakeflow Spark Declarative Pipelines (batch and streaming data pipelines)
  • databricks-apps - Full-stack TypeScript app development and deployment
  • databricks-lakebase - Lakebase Postgres Autoscaling project management
  • databricks-model-serving - Model Serving endpoint management and inference
针对特定产品,请使用专用技能:
  • databricks-jobs - Lakeflow Jobs 开发与部署
  • databricks-pipelines - Lakeflow Spark 声明式流水线(批处理和流处理数据流水线)
  • databricks-apps - 全栈 TypeScript 应用开发与部署
  • databricks-lakebase - Lakebase Postgres 自动扩缩容项目管理
  • databricks-model-serving - 模型服务端点管理与推理

Prerequisites

前置要求

  1. CLI installed: Run
    databricks --version
    to check.
    • If the CLI is missing or outdated (< v0.292.0): STOP. Do not proceed or work around a missing CLI.
    • Read the CLI Installation reference file and follow the instructions to guide the user through installation.
    • Note: In sandboxed environments (Cursor IDE, containers), install commands write outside the workspace and may be blocked. Present the install command to the user and ask them to run it in their own terminal.
  2. Authenticated:
    databricks auth profiles
    • If not: see CLI Authentication
  1. 已安装CLI:运行
    databricks --version
    检查。
    • 如果CLI缺失或版本过旧(< v0.292.0):立即停止。不要继续操作,也不要尝试绕过缺失的CLI。
    • 阅读CLI安装参考文件,按照说明引导用户完成安装。
    • 注意:在沙箱环境(Cursor IDE、容器)中,安装命令的写入位置在工作区之外,可能会被阻止。请向用户提供安装命令,要求他们在自己的终端中运行。
  2. 已完成身份认证:执行
    databricks auth profiles
    验证
    • 如果未认证:参考CLI身份认证

Profile Selection - CRITICAL

配置文件选择 - 关键注意事项

NEVER auto-select a profile.
  1. List profiles:
    databricks auth profiles
  2. Present ALL profiles to user with workspace URLs
  3. Let user choose (even if only one exists)
  4. Offer to create new profile if needed
永远不要自动选择配置文件。
  1. 列出所有配置文件:
    databricks auth profiles
  2. 向用户展示所有配置文件及其对应的工作区URL
  3. 让用户选择(哪怕只有一个配置文件存在)
  4. 如有需要,提供创建新配置文件的选项

Claude Code - IMPORTANT

Claude Code - 重要提示

Each Bash command runs in a separate shell session.
bash
undefined
每条Bash命令都在独立的shell会话中运行。
bash
undefined

WORKS: --profile flag

WORKS: --profile flag

databricks apps list --profile my-workspace
databricks apps list --profile my-workspace

WORKS: chained with &&

WORKS: chained with &&

export DATABRICKS_CONFIG_PROFILE=my-workspace && databricks apps list
export DATABRICKS_CONFIG_PROFILE=my-workspace && databricks apps list

DOES NOT WORK: separate commands

DOES NOT WORK: separate commands

export DATABRICKS_CONFIG_PROFILE=my-workspace databricks apps list # profile not set!
undefined
export DATABRICKS_CONFIG_PROFILE=my-workspace databricks apps list # profile not set!
undefined

Data Exploration — Use AI Tools

数据探查 — 使用AI工具

Use these instead of manually navigating catalogs/schemas/tables:
bash
undefined
请使用以下命令,不要手动遍历 catalog/schema/表:
bash
undefined

discover table structure (columns, types, sample data, stats)

探查表结构(列、类型、样例数据、统计信息)

databricks experimental aitools tools discover-schema catalog.schema.table --profile <PROFILE>
databricks experimental aitools tools discover-schema catalog.schema.table --profile <PROFILE>

run ad-hoc SQL queries

运行即席SQL查询

databricks experimental aitools tools query "SELECT * FROM table LIMIT 10" --profile <PROFILE>
databricks experimental aitools tools query "SELECT * FROM table LIMIT 10" --profile <PROFILE>

find the default warehouse

获取默认仓库

databricks experimental aitools tools get-default-warehouse --profile <PROFILE>

See [Data Exploration](data-exploration.md) for details.
databricks experimental aitools tools get-default-warehouse --profile <PROFILE>

详情参考[数据探查](data-exploration.md)。

Quick Reference

快速参考

⚠️ CRITICAL: Some commands use positional arguments, not flags
bash
undefined
⚠️ 关键提示:部分命令使用位置参数,不是参数标志
bash
undefined

current user

获取当前用户信息

databricks current-user me --profile <PROFILE>
databricks current-user me --profile <PROFILE>

list resources

列出资源

databricks apps list --profile <PROFILE> databricks jobs list --profile <PROFILE> databricks clusters list --profile <PROFILE> databricks warehouses list --profile <PROFILE> databricks pipelines list --profile <PROFILE> databricks serving-endpoints list --profile <PROFILE>
databricks apps list --profile <PROFILE> databricks jobs list --profile <PROFILE> databricks clusters list --profile <PROFILE> databricks warehouses list --profile <PROFILE> databricks pipelines list --profile <PROFILE> databricks serving-endpoints list --profile <PROFILE>

⚠️ Unity Catalog — POSITIONAL arguments (NOT flags!)

⚠️ Unity Catalog — 位置参数(不是参数标志!)

databricks catalogs list --profile <PROFILE>
databricks catalogs list --profile <PROFILE>

✅ CORRECT: positional args

✅ 正确用法:位置参数

databricks schemas list <CATALOG> --profile <PROFILE> databricks tables list <CATALOG> <SCHEMA> --profile <PROFILE> databricks tables get <CATALOG>.<SCHEMA>.<TABLE> --profile <PROFILE>
databricks schemas list <CATALOG> --profile <PROFILE> databricks tables list <CATALOG> <SCHEMA> --profile <PROFILE> databricks tables get <CATALOG>.<SCHEMA>.<TABLE> --profile <PROFILE>

❌ WRONG: these flags/commands DON'T EXIST

❌ 错误用法:这些参数/命令不存在

databricks schemas list --catalog-name <CATALOG> ← WILL FAIL

databricks schemas list --catalog-name <CATALOG> ← 会执行失败

databricks tables list --catalog <CATALOG> ← WILL FAIL

databricks tables list --catalog <CATALOG> ← 会执行失败

databricks sql-warehouses list ← doesn't exist, use
warehouses list

databricks sql-warehouses list ← 不存在,请使用
warehouses list

databricks execute-statement ← doesn't exist, use
experimental aitools tools query

databricks execute-statement ← 不存在,请使用
experimental aitools tools query

databricks sql execute ← doesn't exist, use
experimental aitools tools query

databricks sql execute ← 不存在,请使用
experimental aitools tools query

When in doubt, check help:

有疑问时查看帮助:

databricks schemas list --help

databricks schemas list --help

get details

获取详情

databricks apps get <NAME> --profile <PROFILE> databricks jobs get --job-id <ID> --profile <PROFILE> databricks clusters get --cluster-id <ID> --profile <PROFILE>
databricks apps get <NAME> --profile <PROFILE> databricks jobs get --job-id <ID> --profile <PROFILE> databricks clusters get --cluster-id <ID> --profile <PROFILE>

bundles

bundles相关

databricks bundle init --profile <PROFILE> databricks bundle validate --profile <PROFILE> databricks bundle deploy -t <TARGET> --profile <PROFILE> databricks bundle run <RESOURCE> -t <TARGET> --profile <PROFILE>
undefined
databricks bundle init --profile <PROFILE> databricks bundle validate --profile <PROFILE> databricks bundle deploy -t <TARGET> --profile <PROFILE> databricks bundle run <RESOURCE> -t <TARGET> --profile <PROFILE>
undefined

Troubleshooting

故障排查

ErrorSolution
cannot configure default credentials
Use
--profile
flag or authenticate first
PERMISSION_DENIED
Check workspace/UC permissions
RESOURCE_DOES_NOT_EXIST
Verify resource name/id and profile
错误解决方案
cannot configure default credentials
使用
--profile
参数或先完成身份认证
PERMISSION_DENIED
检查工作区/UC权限
RESOURCE_DOES_NOT_EXIST
验证资源名称/ID以及配置文件是否正确

Required Reading by Task

按任务分类的必读材料

TaskREAD BEFORE proceeding
First time setupCLI Installation
Auth issues / new workspaceCLI Authentication
Exploring tables/schemasData Exploration
Deploying jobs/pipelinesUse
/databricks-dabs
任务操作前必读
首次设置CLI安装
认证问题 / 新工作区配置CLI身份认证
探查表/模式数据探查
部署作业/流水线使用
/databricks-dabs

Reference Guides

参考指南

  • CLI Installation
  • CLI Authentication
  • Data Exploration
  • CLI安装
  • CLI身份认证
  • 数据探查