You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 🥞 Stacked PR
Use this
[link](https://github.com/databricks/databricks-sdk-py/pull/1358/files)
to review incremental changes.
-
[**stack/unified-host-ga**](#1358)
[[Files
changed](https://github.com/databricks/databricks-sdk-py/pull/1358/files)]
---------
<!--
This template provides a recommended structure for PR descriptions.
Adapt it freely — the goal is clarity, not rigid compliance.
The three-section format (Summary / Why / What Changed) helps reviewers
understand the change quickly and makes the PR easier to revisit later.
-->
## Summary
Remove the `experimental_is_unified_host` flag, which was not used
anymore. Update README to document the new support, the updates to
default authentication flow and auto detection.
This PR includes no behavioral changes.
Co-authored-by: Isaac
## How is this tested?
N/A
Copy file name to clipboardExpand all lines: NEXT_CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Release v0.103.0
4
4
5
5
### New Features and Improvements
6
+
* Add support for unified hosts. A single configuration profile can now be used for both account-level and workspace-level operations when the host supports it and both `account_id` and `workspace_id` are available. The `experimental_is_unified_host` flag has been removed; unified host detection is now automatic.
6
7
* Accept `DATABRICKS_OIDC_TOKEN_FILEPATH` environment variable for consistency with other Databricks SDKs (Go, CLI, Terraform). The previous `DATABRICKS_OIDC_TOKEN_FILE` is still supported as an alias.
7
8
8
9
### Security
@@ -27,4 +28,4 @@
27
28
* Add `cascade` field for `databricks.sdk.service.pipelines.DeletePipelineRequest`.
28
29
* Add `default_branch` field for `databricks.sdk.service.postgres.ProjectSpec`.
29
30
* Add `default_branch` field for `databricks.sdk.service.postgres.ProjectStatus`.
30
-
* Add `ingress` and `ingress_dry_run` fields for `databricks.sdk.service.settings.AccountNetworkPolicy`.
31
+
* Add `ingress` and `ingress_dry_run` fields for `databricks.sdk.service.settings.AccountNetworkPolicy`.
4. If the SDK is unsuccessful at this point, it returns an authentication error and stops running.
111
113
112
-
You can instruct the Databricks SDK for Python to use a specific authentication method by setting the `auth_type` argument
113
-
as described in the following sections.
114
+
Each authentication method requires specific configuration attributes (e.g., `token` for PAT auth, `azure_client_id` for Azure service principal auth). The SDK automatically detects the cloud provider and skips authentication methods whose required configuration attributes are not present. This means that Azure-specific methods like `azure-cli` are automatically skipped when connecting to an AWS or GCP workspace, and vice versa for GCP-specific methods.
115
+
116
+
To force a specific authentication method instead of relying on auto-detection, set the `auth_type` argument:
117
+
118
+
```python
119
+
from databricks.sdk import WorkspaceClient
120
+
# Force Azure CLI authentication — skip all other methods
121
+
w = WorkspaceClient(host='https://mycompany.databricks.com', auth_type='azure-cli', cloud='AZURE')
122
+
```
123
+
This is useful when your environment has credentials for multiple authentication methods and you want to ensure a specific one is used or when auto detection is not accurate.
114
124
115
125
For each authentication method, the SDK searches for compatible authentication credentials in the following locations,
116
126
in the following order. Once the SDK finds a compatible set of credentials that it can use, it stops searching:
@@ -125,6 +135,38 @@ in the following order. Once the SDK finds a compatible set of credentials that
125
135
126
136
Depending on the Databricks authentication method, the SDK uses the following information. Presented are the `WorkspaceClient` and `AccountClient` arguments (which have corresponding `.databrickscfg` file fields), their descriptions, and any corresponding environment variables.
127
137
138
+
### Unified host support
139
+
140
+
Certain Databricks host types support both account-level and workspace-level API operations from a single endpoint. When using such a unified host, a single configuration profile can be used to create both `WorkspaceClient` and `AccountClient` instances without changing the `host`.
141
+
142
+
For this to work, the following conditions must be met:
143
+
144
+
1. The host must support unified operations.
145
+
2. Both `account_id` and `workspace_id` must be available — either set explicitly in the configuration or auto-discovered.
146
+
147
+
When both values are present, the SDK uses `workspace_id` to route workspace-level requests and `account_id` to route account-level requests, all through the same host.
148
+
149
+
```ini
150
+
# .databrickscfg
151
+
[unified]
152
+
host = https://mycompany.databricks.com
153
+
account_id = 00000000-0000-0000-0000-000000000000
154
+
workspace_id = 1234567890
155
+
```
156
+
157
+
```python
158
+
from databricks.sdk import WorkspaceClient, AccountClient
159
+
160
+
# Both clients share the same host and profile
161
+
w = WorkspaceClient(profile='unified')
162
+
a = AccountClient(profile='unified')
163
+
164
+
# A WorkspaceClient for a different workspace under the same host and account
165
+
w = WorkspaceClient(profile='unified', workspace_id='2345678901')
166
+
```
167
+
168
+
If the host supports it, `account_id` and `workspace_id` may be auto-discovered, reducing the required explicit configuration.
169
+
128
170
### Databricks native authentication
129
171
130
172
By default, the Databricks SDK for Python initially tries [Databricks token authentication](https://docs.databricks.com/dev-tools/api/latest/authentication.html) (`auth_type='pat'` argument). If the SDK is unsuccessful, it then tries Workload Identity Federation (WIF). See [Supported WIF](https://docs.databricks.com/aws/en/dev-tools/auth/oauth-federation-provider) for the supported JWT token providers.
@@ -133,10 +175,15 @@ By default, the Databricks SDK for Python initially tries [Databricks token auth
133
175
- For Databricks OIDC authentication, you must provide the `host`, `client_id` and `token_audience`_(optional)_ either directly, through the corresponding environment variables, or in your `.databrickscfg` configuration file.
134
176
- For Azure DevOps OIDC authentication, the `token_audience` is irrelevant as the audience is always set to `api://AzureADTokenExchange`. Also, the `System.AccessToken` pipeline variable required for OIDC request must be exposed as the `SYSTEM_ACCESSTOKEN` environment variable, following [Pipeline variables](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#systemaccesstoken)
135
177
178
+
During initialization, the SDK automatically resolves missing configuration fields (`account_id`, `workspace_id`, `cloud`, and `discovery_url`). Any explicitly provided values take precedence and are never overwritten. If the auto discovery fails, the SDK falls back to the explicit configuration. It is recommended to always set explicit configuration.
|`host`|_(String)_ The Databricks host URL for either the Databricks workspace endpoint or the Databricks accounts endpoint. |`DATABRICKS_HOST`|
139
-
|`account_id`|_(String)_ The Databricks account ID for the Databricks accounts endpoint. Only has effect when `Host` is either `https://accounts.cloud.databricks.com/`_(AWS)_, `https://accounts.azuredatabricks.net/`_(Azure)_, or `https://accounts.gcp.databricks.com/`_(GCP)_. |`DATABRICKS_ACCOUNT_ID`|
182
+
|`host`|_(String)_ The Databricks host URL for either the Databricks workspace endpoint or the Databricks accounts endpoint. |`DATABRICKS_HOST`|
183
+
|`account_id`|_(String)_ The Databricks account ID for the Databricks accounts endpoint. Auto-discovered if not provided. |`DATABRICKS_ACCOUNT_ID`|
184
+
|`workspace_id`|_(String)_ The Databricks workspace ID for the Databricks workspace endpoint. Auto-discovered if not provided. |`DATABRICKS_WORKSPACE_ID`|
185
+
|`cloud`|_(String)_ The cloud provider for the Databricks workspace (`AWS`, `AZURE`, or `GCP`). Auto-discovered if not provided. When set, `is_aws`, `is_azure`, and `is_gcp` use this value directly instead of inferring from hostname. |`DATABRICKS_CLOUD`|
186
+
|`discovery_url`|_(String)_ The OpenID Connect discovery URL. Auto-discovered if not provided. When set, OIDC endpoints are fetched directly from this URL instead of using the default host-based well-known endpoint logic. |`DATABRICKS_DISCOVERY_URL`|
140
187
|`token`|_(String)_ The Databricks personal access token (PAT) _(AWS, Azure, and GCP)_ or Azure Active Directory (Azure AD) token _(Azure)_. |`DATABRICKS_TOKEN`|
141
188
|`client_id`|_(String)_ The Databricks Service Principal Application ID. |`DATABRICKS_CLIENT_ID`|
142
189
|`token_audience`|_(String)_ When using Workload Identity Federation, the audience to specify when fetching an ID token from the ID token supplier. |`TOKEN_AUDIENCE`|
`with_product()` can be used to define the name and version of the product that is built with the Databricks SDK for Python. The product name has the same restrictions as the partner name above, and the product version must be a valid [SemVer](https://semver.org/). Subsequent calls to `with_product()` replace the original product with the new user-specified one.
0 commit comments