diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 3e1502b75..a45073881 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -5,6 +5,7 @@ ### New Features and Improvements * Added support for passing additional kwargs to `WorkspaceClient().serving_endpoints.get_open_ai_client()` ([#1025](https://github.com/databricks/databricks-sdk-py/pull/1025)). Users can now pass standard OpenAI client parameters like `timeout` and `max_retries` when creating an OpenAI client for Databricks Model Serving. +* Enable remove DBUtils in Shared Clusters ([#1033](https://github.com/databricks/databricks-sdk-py/pull/1033)). ### Bug Fixes diff --git a/databricks/sdk/__init__.py b/databricks/sdk/__init__.py index a426eebfb..62534b58b 100755 --- a/databricks/sdk/__init__.py +++ b/databricks/sdk/__init__.py @@ -167,9 +167,14 @@ def _make_dbutils(config: client.Config): return dbutils.RemoteDbUtils(config) # We are in runtime, so we can use the runtime dbutils - from databricks.sdk.runtime import dbutils as runtime_dbutils + try: + from databricks.sdk.runtime import dbutils as runtime_dbutils - return runtime_dbutils + return runtime_dbutils + except ImportError: + # Expected on shared clusters where runtime dbutils access is restricted + _LOG.debug("Runtime dbutils not available, falling back to RemoteDbUtils (likely shared cluster)") + return dbutils.RemoteDbUtils(config) def _make_files_client(apiClient: client.ApiClient, config: client.Config):