Skip to content

WorkbenchStrategy() fails if workbench is not a defined profile #413

Open
@blairj09

Description

@blairj09

In trying to create an app that can run seamlessly locally, in Posit Workbench, and in Posit Connect, I have the following setup to configure my WorkspaceClient:

from databricks.sdk import WorkspaceClient
from databricks.sdk.core import databricks_cli
from posit.workbench.external.databricks import WorkbenchStrategy
from posit.connect.external.databricks import ConnectStrategy, databricks_config

w = WorkspaceClient(
    config = databricks_config(
        posit_default_strategy = databricks_cli,
        posit_workbench_strategy = WorkbenchStrategy(),
        posit_connect_strategy = ConnectStrategy(user_session_token = session_token)
    )
)

w.current_user.me().display_name

However, when I try to create the WorkSpace client, I get this error:

ValueError: resolve: /Users/jamesblair/.databrickscfg has no workbench profile configured. Config: profile=workbench
File [~/Documents/Posit/repos/data-and-ai-summit-2025/.venv/lib/python3.11/site-packages/databricks/sdk/config.py:182](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#), in Config.__init__(self, credentials_provider, credentials_strategy, product, product_version, clock, **kwargs)
    181 self._load_from_env()
--> 182 self._known_file_config_loader()
    183 self._fix_host_if_needed()
Show Traceback

My expectation would be that WorkbenchStrategy() doesn't require a workbench profile unless it's the strategy that will be used. In the case of my local environment, I want to use databricks_cli as my strategy.

Metadata

Metadata

Assignees

Labels

sdkUsed for automation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions