|
14 | 14 | from ._base_client import _fix_host_if_needed |
15 | 15 | from .clock import Clock, RealClock |
16 | 16 | from .credentials_provider import CredentialsStrategy, DefaultCredentials |
17 | | -from .environments import (ALL_ENVS, AzureEnvironment, Cloud, |
18 | | - DatabricksEnvironment, get_environment_for_hostname) |
19 | | -from .oauth import (OidcEndpoints, Token, get_account_endpoints, |
20 | | - get_azure_entra_id_workspace_endpoints, |
21 | | - get_workspace_endpoints) |
| 17 | +from .environments import ALL_ENVS, AzureEnvironment, Cloud, DatabricksEnvironment, get_environment_for_hostname |
| 18 | +from .oauth import ( |
| 19 | + OidcEndpoints, |
| 20 | + Token, |
| 21 | + get_account_endpoints, |
| 22 | + get_azure_entra_id_workspace_endpoints, |
| 23 | + get_workspace_endpoints, |
| 24 | +) |
22 | 25 |
|
23 | 26 | logger = logging.getLogger("databricks.sdk") |
24 | 27 |
|
@@ -60,10 +63,21 @@ def with_user_agent_extra(key: str, value: str): |
60 | 63 | class Config: |
61 | 64 | host: str = ConfigAttribute(env="DATABRICKS_HOST") |
62 | 65 | account_id: str = ConfigAttribute(env="DATABRICKS_ACCOUNT_ID") |
| 66 | + |
| 67 | + # PAT token. |
63 | 68 | token: str = ConfigAttribute(env="DATABRICKS_TOKEN", auth="pat", sensitive=True) |
| 69 | + |
| 70 | + # Audience for OIDC ID token source accepting an audience as a parameter. |
| 71 | + # For example, the GitHub action ID token source. |
64 | 72 | token_audience: str = ConfigAttribute(env="DATABRICKS_TOKEN_AUDIENCE", auth="github-oidc") |
| 73 | + |
| 74 | + # Environment variable for OIDC token. |
| 75 | + oidc_token_env: str = ConfigAttribute(env="DATABRICKS_OIDC_TOKEN_ENV", auth="env-oidc") |
| 76 | + oidc_token_filepath: str = ConfigAttribute(env="DATABRICKS_OIDC_TOKEN_FILE", auth="file-oidc") |
| 77 | + |
65 | 78 | username: str = ConfigAttribute(env="DATABRICKS_USERNAME", auth="basic") |
66 | 79 | password: str = ConfigAttribute(env="DATABRICKS_PASSWORD", auth="basic", sensitive=True) |
| 80 | + |
67 | 81 | client_id: str = ConfigAttribute(env="DATABRICKS_CLIENT_ID", auth="oauth") |
68 | 82 | client_secret: str = ConfigAttribute(env="DATABRICKS_CLIENT_SECRET", auth="oauth", sensitive=True) |
69 | 83 | profile: str = ConfigAttribute(env="DATABRICKS_CONFIG_PROFILE") |
@@ -194,7 +208,7 @@ def oauth_token(self) -> Token: |
194 | 208 | def wrap_debug_info(self, message: str) -> str: |
195 | 209 | debug_string = self.debug_string() |
196 | 210 | if debug_string: |
197 | | - message = f'{message.rstrip(".")}. {debug_string}' |
| 211 | + message = f"{message.rstrip('.')}. {debug_string}" |
198 | 212 | return message |
199 | 213 |
|
200 | 214 | @staticmethod |
@@ -337,9 +351,9 @@ def debug_string(self) -> str: |
337 | 351 | safe = "***" if attr.sensitive else f"{value}" |
338 | 352 | attrs_used.append(f"{attr.name}={safe}") |
339 | 353 | if attrs_used: |
340 | | - buf.append(f'Config: {", ".join(attrs_used)}') |
| 354 | + buf.append(f"Config: {', '.join(attrs_used)}") |
341 | 355 | if envs_used: |
342 | | - buf.append(f'Env: {", ".join(envs_used)}') |
| 356 | + buf.append(f"Env: {', '.join(envs_used)}") |
343 | 357 | return ". ".join(buf) |
344 | 358 |
|
345 | 359 | def to_dict(self) -> Dict[str, any]: |
@@ -481,7 +495,7 @@ def _known_file_config_loader(self): |
481 | 495 | if profile not in profiles: |
482 | 496 | raise ValueError(f"resolve: {config_path} has no {profile} profile configured") |
483 | 497 | raw_config = profiles[profile] |
484 | | - logger.info(f'loading {profile} profile from {config_file}: {", ".join(raw_config.keys())}') |
| 498 | + logger.info(f"loading {profile} profile from {config_file}: {', '.join(raw_config.keys())}") |
485 | 499 | for k, v in raw_config.items(): |
486 | 500 | if k in self._inner: |
487 | 501 | # don't overwrite a value previously set |
|
0 commit comments