Skip to content
Merged
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
8 changes: 6 additions & 2 deletions sqlmesh/core/config/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,6 @@ class SnowflakeConnectionConfig(ConnectionConfig):
type_: t.Literal["snowflake"] = Field(alias="type", default="snowflake")

_concurrent_tasks_validator = concurrent_tasks_validator
_engine_import_validator = _get_engine_import_validator("snowflake", "snowflake")

@model_validator(mode="before")
def _validate_authenticator(cls, data: t.Any) -> t.Any:
Expand All @@ -567,6 +566,10 @@ def _validate_authenticator(cls, data: t.Any) -> t.Any:

return data

_engine_import_validator = _get_engine_import_validator(
"snowflake.connector.network", "snowflake"
)
Comment on lines +569 to +571
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FMI, how does moving this affect the execution / validation order? Asking based on this bit in the description:

Additionally, rearranged the model validators so that the import validator always runs first.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want this to run before _validate_authenticator which uses the imports


@classmethod
def _get_private_key(cls, values: t.Dict[str, t.Optional[str]], auth: str) -> t.Optional[bytes]:
"""
Expand Down Expand Up @@ -734,7 +737,6 @@ class DatabricksConnectionConfig(ConnectionConfig):

_concurrent_tasks_validator = concurrent_tasks_validator
_http_headers_validator = http_headers_validator
_engine_import_validator = _get_engine_import_validator("databricks", "databricks")

@model_validator(mode="before")
def _databricks_connect_validator(cls, data: t.Any) -> t.Any:
Expand Down Expand Up @@ -812,6 +814,8 @@ def _databricks_connect_validator(cls, data: t.Any) -> t.Any:

return data

_engine_import_validator = _get_engine_import_validator("databricks", "databricks")

@property
def _connection_kwargs_keys(self) -> t.Set[str]:
if self.use_spark_session_only:
Expand Down