databricks-config

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Configure the Databricks profile in ~/.databrickscfg for use with Databricks Connect.
Usage:
/databricks-config [profile_name|workspace_host]
Examples:
  • /databricks-config
    - Configure DEFAULT profile (interactive)
  • /databricks-config DEFAULT
    - Configure DEFAULT profile
  • /databricks-config my-workspace
    - Configure profile named "my-workspace"
  • /databricks-config https://adb-1234567890123456.7.azuredatabricks.net/
    - Configure using workspace host URL
在~/.databrickscfg中配置Databricks配置文件,以供Databricks Connect使用。
使用方式:
/databricks-config [profile_name|workspace_host]
示例:
  • /databricks-config
    - 以交互方式配置DEFAULT配置文件
  • /databricks-config DEFAULT
    - 配置DEFAULT配置文件
  • /databricks-config my-workspace
    - 配置名为"my-workspace"的配置文件
  • /databricks-config https://adb-1234567890123456.7.azuredatabricks.net/
    - 通过工作区主机URL进行配置

Task

操作步骤

  1. Determine the profile and host:
    • If a parameter is provided and it starts with
      https://
      , treat it as a workspace host:
      • Extract profile name from the host (e.g.,
        adb-1234567890123456.7.azuredatabricks.net
        adb-1234567890123456
        ,
        my-company-dev.cloud.databricks.com
        my-company-dev
        )
      • Use this as the profile name and configure it with the provided host
    • If a parameter is provided and it doesn't start with
      https://
      , treat it as a profile name
    • If no parameter is provided, ask the user which profile they want to configure (default: DEFAULT)
  2. Run
    databricks auth login -p <profile>
    with the determined profile name
    • If a workspace host was provided, add
      --host <workspace_host>
      to the command
    • This ensures authentication is completed and the profile works
  3. Check if the profile exists in ~/.databrickscfg
  4. Ask the user to choose ONE of the following compute options:
    • Cluster ID: Provide a specific cluster ID for an interactive/all-purpose cluster
    • Serverless: Use serverless compute (sets
      serverless_compute_id = auto
      )
  5. Update the profile in ~/.databrickscfg with the selected configuration
  6. Verify the configuration by displaying the updated profile section
  1. 确定配置文件与主机地址:
    • 如果提供的参数以
      https://
      开头,则将其视为工作区主机地址:
      • 从主机地址中提取配置文件名称(例如:
        adb-1234567890123456.7.azuredatabricks.net
        adb-1234567890123456
        my-company-dev.cloud.databricks.com
        my-company-dev
      • 将提取出的名称作为配置文件名称,并结合提供的主机地址完成配置
    • 如果提供的参数不以
      https://
      开头,则将其视为配置文件名称
    • 如果未提供任何参数,则询问用户要配置哪个配置文件(默认:DEFAULT)
  2. 使用确定的配置文件名称执行
    databricks auth login -p <profile>
    命令
    • 如果已提供工作区主机地址,需在命令中添加
      --host <workspace_host>
      参数
    • 此步骤确保认证完成且配置文件可正常使用
  3. 检查该配置文件是否存在于~/.databrickscfg中
  4. 请用户从以下计算选项中选择其一:
    • Cluster ID:提供交互式/通用集群的特定集群ID
    • Serverless:使用无服务器计算(设置
      serverless_compute_id = auto
  5. 将所选配置更新到~/.databrickscfg中的对应配置文件
  6. 通过显示更新后的配置文件片段来验证配置是否生效

Important Notes

重要说明

  • Use the AskUserQuestion tool to present the compute options as a choice
  • Only add ONE of:
    cluster_id
    OR
    serverless_compute_id
    (never both)
  • For serverless, set
    serverless_compute_id = auto
    (not just
    serverless = true
    )
  • Preserve all existing settings in the profile (host, auth_type, etc.)
  • Format the configuration file consistently with proper spacing
  • The
    databricks auth login
    command will open a browser for OAuth authentication
  • SECURITY: NEVER print token values in plain text
    • When displaying configuration, redact any
      token
      field values (e.g.,
      token = [REDACTED]
      )
    • Inform the user they can view the full configuration at
      ~/.databrickscfg
    • This applies to any output showing the profile configuration
  • 使用AskUserQuestion工具将计算选项以选择形式呈现给用户
  • 仅能添加以下其中一项:
    cluster_id
    serverless_compute_id
    (绝不能同时添加)
  • 若选择无服务器计算,需设置
    serverless_compute_id = auto
    (而非仅设置
    serverless = true
  • 保留配置文件中的所有现有设置(如host、auth_type等)
  • 保持配置文件格式一致,使用适当的间距
  • 执行
    databricks auth login
    命令后将打开浏览器以完成OAuth认证
  • 安全提示:绝对不要明文打印令牌值
    • 显示配置时,需对所有
      token
      字段值进行脱敏处理(例如:
      token = [REDACTED]
    • 告知用户可在
      ~/.databrickscfg
      中查看完整配置
    • 此要求适用于所有显示配置文件内容的输出

Example Configurations

配置示例

With Cluster ID:
[DEFAULT]
host       = https://adb-123456789.11.azuredatabricks.net/
cluster_id = 1217-064531-c9c3ngyn
auth_type  = databricks-cli
With Serverless:
[DEFAULT]
host                  = https://adb-123456789.11.azuredatabricks.net/
serverless_compute_id = auto
auth_type             = databricks-cli
With Token (display as redacted):
[DEFAULT]
host       = https://adb-123456789.11.azuredatabricks.net/
token      = [REDACTED]
cluster_id = 1217-064531-c9c3ngyn

View full configuration at: ~/.databrickscfg
使用Cluster ID的配置:
[DEFAULT]
host       = https://adb-123456789.11.azuredatabricks.net/
cluster_id = 1217-064531-c9c3ngyn
auth_type  = databricks-cli
使用无服务器计算的配置:
[DEFAULT]
host                  = https://adb-123456789.11.azuredatabricks.net/
serverless_compute_id = auto
auth_type             = databricks-cli
包含令牌的配置(显示时脱敏):
[DEFAULT]
host       = https://adb-123456789.11.azuredatabricks.net/
token      = [REDACTED]
cluster_id = 1217-064531-c9c3ngyn

查看完整配置请访问:~/.databrickscfg