Skip to content

Commit 79a7304

Browse files
committed
Aligned U2M detection method for shared_connection with _static_connection_kwargs.
Signed-off-by: davem-bis <68955845+davem-bis@users.noreply.github.com>
1 parent c5b4eaa commit 79a7304

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎sqlmesh/core/config/connection.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ class DatabricksConnectionConfig(ConnectionConfig):
837837
@property
838838
def shared_connection(self) -> bool:
839839
"""The connection should only be shared if U2M OAuth is being used"""
840-
return self.auth_type is not None and self.oauth_client_id is None
840+
return self.auth_type is not None and self.oauth_client_secret is None
841841

842842
@model_validator(mode="before")
843843
def _databricks_connect_validator(cls, data: t.Any) -> t.Any:

‎tests/core/test_connection_config.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,8 @@ def test_databricks__u2m_oauth__shared_connection_pool(make_config):
14561456
assert isinstance(adapter._connection_pool, ThreadLocalSharedConnectionPool)
14571457

14581458

1459-
def test_databricks__m2m_oauth__connection_pool(make_config):
1459+
@patch.object(DatabricksConnectionConfig, "_connection_factory_with_kwargs")
1460+
def test_databricks__m2m_oauth__connection_pool(mock_connection_factory_with_kwargs, make_config):
14601461
from sqlmesh.utils.connection_pool import ThreadLocalConnectionPool
14611462

14621463
config = make_config(
@@ -1465,6 +1466,7 @@ def test_databricks__m2m_oauth__connection_pool(make_config):
14651466
http_path="sql/test/foo",
14661467
auth_type="databricks-oauth",
14671468
oauth_client_id="oauth_client_id",
1469+
oauth_client_secret="oauth_client_secret",
14681470
concurrent_tasks=4,
14691471
)
14701472
assert isinstance(config, DatabricksConnectionConfig)

0 commit comments

Comments
 (0)