Skip to content

Commit a8a9c49

Browse files
Chore: Add assertions to fix mypy errors for trino connection
1 parent 6e69ce6 commit a8a9c49

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sqlmesh/core/config/connection.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,17 @@ def _static_connection_kwargs(self) -> t.Dict[str, t.Any]:
20132013
OAuth2Authentication,
20142014
)
20152015

2016+
auth: t.Optional[
2017+
t.Union[
2018+
BasicAuthentication,
2019+
KerberosAuthentication,
2020+
OAuth2Authentication,
2021+
JWTAuthentication,
2022+
CertificateAuthentication,
2023+
]
2024+
] = None
20162025
if self.method.is_basic or self.method.is_ldap:
2026+
assert self.password is not None # for mypy since validator already checks this
20172027
auth = BasicAuthentication(self.user, self.password)
20182028
elif self.method.is_kerberos:
20192029
if self.keytab:
@@ -2032,11 +2042,12 @@ def _static_connection_kwargs(self) -> t.Dict[str, t.Any]:
20322042
elif self.method.is_oauth:
20332043
auth = OAuth2Authentication()
20342044
elif self.method.is_jwt:
2045+
assert self.jwt_token is not None
20352046
auth = JWTAuthentication(self.jwt_token)
20362047
elif self.method.is_certificate:
2048+
assert self.client_certificate is not None
2049+
assert self.client_private_key is not None
20372050
auth = CertificateAuthentication(self.client_certificate, self.client_private_key)
2038-
else:
2039-
auth = None
20402051

20412052
return {
20422053
"auth": auth,

0 commit comments

Comments
 (0)