databricks-config
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConfigure the Databricks profile in ~/.databrickscfg for use with Databricks Connect.
Usage:
/databricks-config [profile_name|workspace_host]Examples:
- - Configure DEFAULT profile (interactive)
/databricks-config - - Configure DEFAULT profile
/databricks-config DEFAULT - - Configure profile named "my-workspace"
/databricks-config my-workspace - - Configure using workspace host URL
/databricks-config https://adb-1234567890123456.7.azuredatabricks.net/
在~/.databrickscfg中配置Databricks配置文件,以供Databricks Connect使用。
使用方式:
/databricks-config [profile_name|workspace_host]示例:
- - 以交互方式配置DEFAULT配置文件
/databricks-config - - 配置DEFAULT配置文件
/databricks-config DEFAULT - - 配置名为"my-workspace"的配置文件
/databricks-config my-workspace - - 通过工作区主机URL进行配置
/databricks-config https://adb-1234567890123456.7.azuredatabricks.net/
Task
操作步骤
-
Determine the profile and host:
- If a parameter is provided and it starts with , treat it as a workspace host:
https://- 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
- Extract profile name from the host (e.g.,
- If a parameter is provided and it doesn't start with , treat it as a profile name
https:// - If no parameter is provided, ask the user which profile they want to configure (default: DEFAULT)
- If a parameter is provided and it starts with
-
Runwith the determined profile name
databricks auth login -p <profile>- If a workspace host was provided, add to the command
--host <workspace_host> - This ensures authentication is completed and the profile works
- If a workspace host was provided, add
-
Check if the profile exists in ~/.databrickscfg
-
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
-
Update the profile in ~/.databrickscfg with the selected configuration
-
Verify the configuration by displaying the updated profile section
-
确定配置文件与主机地址:
- 如果提供的参数以开头,则将其视为工作区主机地址:
https://- 从主机地址中提取配置文件名称(例如:→
adb-1234567890123456.7.azuredatabricks.net,adb-1234567890123456→my-company-dev.cloud.databricks.com)my-company-dev - 将提取出的名称作为配置文件名称,并结合提供的主机地址完成配置
- 从主机地址中提取配置文件名称(例如:
- 如果提供的参数不以开头,则将其视为配置文件名称
https:// - 如果未提供任何参数,则询问用户要配置哪个配置文件(默认:DEFAULT)
- 如果提供的参数以
-
使用确定的配置文件名称执行命令
databricks auth login -p <profile>- 如果已提供工作区主机地址,需在命令中添加参数
--host <workspace_host> - 此步骤确保认证完成且配置文件可正常使用
- 如果已提供工作区主机地址,需在命令中添加
-
检查该配置文件是否存在于~/.databrickscfg中
-
请用户从以下计算选项中选择其一:
- Cluster ID:提供交互式/通用集群的特定集群ID
- Serverless:使用无服务器计算(设置)
serverless_compute_id = auto
-
将所选配置更新到~/.databrickscfg中的对应配置文件
-
通过显示更新后的配置文件片段来验证配置是否生效
Important Notes
重要说明
- Use the AskUserQuestion tool to present the compute options as a choice
- Only add ONE of: OR
cluster_id(never both)serverless_compute_id - For serverless, set (not just
serverless_compute_id = auto)serverless = true - Preserve all existing settings in the profile (host, auth_type, etc.)
- Format the configuration file consistently with proper spacing
- The command will open a browser for OAuth authentication
databricks auth login - SECURITY: NEVER print token values in plain text
- When displaying configuration, redact any field values (e.g.,
token)token = [REDACTED] - Inform the user they can view the full configuration at
~/.databrickscfg - This applies to any output showing the profile configuration
- When displaying configuration, redact any
- 使用AskUserQuestion工具将计算选项以选择形式呈现给用户
- 仅能添加以下其中一项:或
cluster_id(绝不能同时添加)serverless_compute_id - 若选择无服务器计算,需设置(而非仅设置
serverless_compute_id = auto)serverless = true - 保留配置文件中的所有现有设置(如host、auth_type等)
- 保持配置文件格式一致,使用适当的间距
- 执行命令后将打开浏览器以完成OAuth认证
databricks auth login - 安全提示:绝对不要明文打印令牌值
- 显示配置时,需对所有字段值进行脱敏处理(例如:
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-cliWith Serverless:
[DEFAULT]
host = https://adb-123456789.11.azuredatabricks.net/
serverless_compute_id = auto
auth_type = databricks-cliWith 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