Skip to content

Commit 3f200dc

Browse files
committed
Allow authenticator parameter when connecting to snowflake
1 parent e3f3e22 commit 3f200dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

landingai/predict/snowflake.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __init__(
2828
# TODO: Remove this once we remove the API key auth from snowflake
2929
api_key: Optional[str] = None,
3030
check_server_ready: bool = True,
31+
*,
32+
snowflake_authenticator: Optional[str] = None,
3133
) -> None:
3234
assert (
3335
snowflake_password is not None or snowflake_private_key is not None
@@ -40,6 +42,7 @@ def __init__(
4042
self.snowflake_user = snowflake_user
4143
self.snowflake_password = snowflake_password
4244
self.snowflake_private_key = snowflake_private_key
45+
self.snowflake_authenticator = snowflake_authenticator
4346

4447
self._auth_token = None
4548
self._last_auth_token_fetch: Optional[datetime.datetime] = None
@@ -86,6 +89,8 @@ def _get_auth_token(self) -> str:
8689
format=serialization.PrivateFormat.PKCS8,
8790
encryption_algorithm=serialization.NoEncryption(),
8891
)
92+
if self.snowflake_authenticator is not None:
93+
connect_params["authenticator"] = self.snowflake_authenticator
8994

9095
ctx = snowflake.connector.connect(**connect_params)
9196
ctx._all_async_queries_finished = lambda: False # type: ignore

0 commit comments

Comments
 (0)