Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## Release v0.51.0

### New Features and Improvements
* Enabled asynchronous token refreshes by default. A new `disable_async_token_refresh` configuration option has been added to allow disabling this feature if necessary ([#952](https://github.com/databricks/databricks-sdk-py/pull/952)).
To disable asynchronous token refresh, set the environment variable `DATABRICKS_DISABLE_ASYNC_TOKEN_REFRESH=true` or configure it within your configuration object.
The previous `enable_experimental_async_token_refresh` option has been removed as asynchronous refresh is now the default behavior.

### Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions databricks/sdk/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions databricks/sdk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ class Config:
max_connections_per_pool: int = ConfigAttribute()
databricks_environment: Optional[DatabricksEnvironment] = None

enable_experimental_async_token_refresh: bool = ConfigAttribute(
env="DATABRICKS_ENABLE_EXPERIMENTAL_ASYNC_TOKEN_REFRESH"
)
disable_async_token_refresh: bool = ConfigAttribute(env="DATABRICKS_DISABLE_ASYNC_TOKEN_REFRESH")

enable_experimental_files_api_client: bool = ConfigAttribute(env="DATABRICKS_ENABLE_EXPERIMENTAL_FILES_API_CLIENT")
files_api_client_download_max_total_recovers = None
Expand Down
8 changes: 4 additions & 4 deletions databricks/sdk/credentials_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def oauth_service_principal(cfg: "Config") -> Optional[CredentialsProvider]:
token_url=oidc.token_endpoint,
scopes=["all-apis"],
use_header=True,
disable_async=not cfg.enable_experimental_async_token_refresh,
disable_async=cfg.disable_async_token_refresh,
)

def inner() -> Dict[str, str]:
Expand Down Expand Up @@ -291,7 +291,7 @@ def token_source_for(resource: str) -> TokenSource:
token_url=f"{aad_endpoint}{cfg.azure_tenant_id}/oauth2/token",
endpoint_params={"resource": resource},
use_params=True,
disable_async=not cfg.enable_experimental_async_token_refresh,
disable_async=cfg.disable_async_token_refresh,
)

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

def refreshed_headers() -> Dict[str, str]:
Expand Down Expand Up @@ -694,7 +694,7 @@ def __init__(self, cfg: "Config"):
token_type_field="token_type",
access_token_field="access_token",
expiry_field="expiry",
disable_async=not cfg.enable_experimental_async_token_refresh,
disable_async=cfg.disable_async_token_refresh,
)

@staticmethod
Expand Down
Loading