From a8a9c49d0b7533c57ef9dd9a3526b92f1e4b8bb4 Mon Sep 17 00:00:00 2001 From: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:05:34 +0200 Subject: [PATCH 1/2] Chore: Add assertions to fix mypy errors for trino connection --- sqlmesh/core/config/connection.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sqlmesh/core/config/connection.py b/sqlmesh/core/config/connection.py index 9e3a210e5e..26bfa78730 100644 --- a/sqlmesh/core/config/connection.py +++ b/sqlmesh/core/config/connection.py @@ -2013,7 +2013,17 @@ def _static_connection_kwargs(self) -> t.Dict[str, t.Any]: OAuth2Authentication, ) + auth: t.Optional[ + t.Union[ + BasicAuthentication, + KerberosAuthentication, + OAuth2Authentication, + JWTAuthentication, + CertificateAuthentication, + ] + ] = None if self.method.is_basic or self.method.is_ldap: + assert self.password is not None # for mypy since validator already checks this auth = BasicAuthentication(self.user, self.password) elif self.method.is_kerberos: if self.keytab: @@ -2032,11 +2042,12 @@ def _static_connection_kwargs(self) -> t.Dict[str, t.Any]: elif self.method.is_oauth: auth = OAuth2Authentication() elif self.method.is_jwt: + assert self.jwt_token is not None auth = JWTAuthentication(self.jwt_token) elif self.method.is_certificate: + assert self.client_certificate is not None + assert self.client_private_key is not None auth = CertificateAuthentication(self.client_certificate, self.client_private_key) - else: - auth = None return { "auth": auth, From 23df248f51e09b6d4e3c9030eb9b8e7ed8bf260c Mon Sep 17 00:00:00 2001 From: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:51:34 +0200 Subject: [PATCH 2/2] adapt tests for latest duckdb --- tests/core/integration/test_aux_commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/core/integration/test_aux_commands.py b/tests/core/integration/test_aux_commands.py index ecdd3e05fc..326e81e0c1 100644 --- a/tests/core/integration/test_aux_commands.py +++ b/tests/core/integration/test_aux_commands.py @@ -287,20 +287,20 @@ def test_destroy(copy_to_temp_path): # Validate tables have been deleted as well with pytest.raises( - Exception, match=r"Catalog Error: Table with name model_two does not exist!" + Exception, match=r"Catalog Error: Table with name.*model_two.*does not exist" ): context.fetchdf("SELECT * FROM db_1.first_schema.model_two") with pytest.raises( - Exception, match=r"Catalog Error: Table with name model_one does not exist!" + Exception, match=r"Catalog Error: Table with name.*model_one.*does not exist" ): context.fetchdf("SELECT * FROM db_1.first_schema.model_one") with pytest.raises( - Exception, match=r"Catalog Error: Table with name model_two does not exist!" + Exception, match=r"Catalog Error: Table with name.*model_two.*does not exist" ): context.engine_adapters["second"].fetchdf("SELECT * FROM db_2.second_schema.model_two") with pytest.raises( - Exception, match=r"Catalog Error: Table with name model_one does not exist!" + Exception, match=r"Catalog Error: Table with name.*model_one.*does not exist" ): context.engine_adapters["second"].fetchdf("SELECT * FROM db_2.second_schema.model_one")