databricks

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-apps - Full-stack TypeScript app development and deployment
针对特定产品,请使用专用技能:
  • databricks-apps - 全栈TypeScript应用开发与部署

Prerequisites

前置条件

  1. CLI installed:
    databricks --version
    • If not: see CLI Installation
  2. Authenticated:
    databricks auth profiles
    • If not: see CLI Authentication
  1. 已安装CLI
    databricks --version
    • 若未安装:请查看CLI安装文档
  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
请使用以下工具替代手动导航目录/模式/表:
bash
undefined

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

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

run ad-hoc SQL queries

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

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 — POSITIONAL arguments (NOT flags!)

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

资源包操作

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
UC permissions/volumesUnity Catalog
Deploying jobs/pipelinesAsset Bundles
任务操作前必读
首次设置CLI安装文档
认证问题 / 新增工作区CLI认证文档
表/模式探索数据探索文档
UC权限/卷管理Unity Catalog文档
作业/流水线部署资源包文档

Reference Guides

参考指南

  • CLI Installation
  • CLI Authentication
  • Data Exploration
  • Unity Catalog
  • Asset Bundles
  • Jobs
  • LakeFlow
  • Model Serving
  • DBSQL
  • Clusters
  • Workspace
  • Secrets
  • DBFS (legacy - prefer UC Volumes)
  • AI/BI Dashboards
  • Genie
  • CLI安装文档
  • CLI认证文档
  • 数据探索文档
  • Unity Catalog文档
  • 资源包文档
  • 作业文档
  • LakeFlow文档
  • 模型服务文档
  • DBSQL文档
  • 集群文档
  • 工作区文档
  • 密钥管理文档
  • DBFS文档(旧版 - 推荐使用UC Volumes)
  • AI/BI仪表盘文档
  • Genie文档