Skip to content

Commit f1bdd02

Browse files
committed
Enable async token refresh by default
1 parent 1f3ecce commit f1bdd02

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

NEXT_CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
## Release v0.51.0
44

55
### New Features and Improvements
6+
* Made async token refresh the default behavior. Added `disable_async_token_refresh` configuration option to disable it if needed ([#952](https://github.com/databricks/databricks-sdk-py/pull/952)).
7+
To disable async token refresh, set environment variable `DATABRICKS_DISABLE_ASYNC_TOKEN_REFRESH=true` or configure it in your config object.
8+
The previous `enable_experimental_async_token_refresh` option has been removed as async refresh is now the default.
69

710
### Bug Fixes
811

databricks/sdk/__init__.py

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks/sdk/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ class Config:
9595
max_connections_per_pool: int = ConfigAttribute()
9696
databricks_environment: Optional[DatabricksEnvironment] = None
9797

98-
enable_experimental_async_token_refresh: bool = ConfigAttribute(
99-
env="DATABRICKS_ENABLE_EXPERIMENTAL_ASYNC_TOKEN_REFRESH"
98+
disable_async_token_refresh: bool = ConfigAttribute(
99+
env="DATABRICKS_DISABLE_ASYNC_TOKEN_REFRESH"
100100
)
101101

102102
enable_experimental_files_api_client: bool = ConfigAttribute(env="DATABRICKS_ENABLE_EXPERIMENTAL_FILES_API_CLIENT")

databricks/sdk/credentials_provider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def oauth_service_principal(cfg: "Config") -> Optional[CredentialsProvider]:
191191
token_url=oidc.token_endpoint,
192192
scopes=["all-apis"],
193193
use_header=True,
194-
disable_async=not cfg.enable_experimental_async_token_refresh,
194+
disable_async=cfg.disable_async_token_refresh,
195195
)
196196

197197
def inner() -> Dict[str, str]:
@@ -291,7 +291,7 @@ def token_source_for(resource: str) -> TokenSource:
291291
token_url=f"{aad_endpoint}{cfg.azure_tenant_id}/oauth2/token",
292292
endpoint_params={"resource": resource},
293293
use_params=True,
294-
disable_async=not cfg.enable_experimental_async_token_refresh,
294+
disable_async=cfg.disable_async_token_refresh,
295295
)
296296

297297
_ensure_host_present(cfg, token_source_for)
@@ -357,7 +357,7 @@ def github_oidc_azure(cfg: "Config") -> Optional[CredentialsProvider]:
357357
token_url=f"{aad_endpoint}{cfg.azure_tenant_id}/oauth2/token",
358358
endpoint_params=params,
359359
use_params=True,
360-
disable_async=not cfg.enable_experimental_async_token_refresh,
360+
disable_async=cfg.disable_async_token_refresh,
361361
)
362362

363363
def refreshed_headers() -> Dict[str, str]:
@@ -694,7 +694,7 @@ def __init__(self, cfg: "Config"):
694694
token_type_field="token_type",
695695
access_token_field="access_token",
696696
expiry_field="expiry",
697-
disable_async=not cfg.enable_experimental_async_token_refresh,
697+
disable_async=cfg.disable_async_token_refresh,
698698
)
699699

700700
@staticmethod

0 commit comments

Comments
 (0)