From 976450f874f9868ce711feb455e780fa6a5b7141 Mon Sep 17 00:00:00 2001 From: Chris Nivera Date: Tue, 30 Jul 2024 10:47:27 -0700 Subject: [PATCH] use union for type hints --- semantic_model_generator/snowflake_utils/utils.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/semantic_model_generator/snowflake_utils/utils.py b/semantic_model_generator/snowflake_utils/utils.py index 6de58c6c..e6b041f8 100644 --- a/semantic_model_generator/snowflake_utils/utils.py +++ b/semantic_model_generator/snowflake_utils/utils.py @@ -1,4 +1,4 @@ -from typing import Dict, Optional +from typing import Dict, Optional, Union from snowflake.connector import connect from snowflake.connector.connection import SnowflakeConnection @@ -30,8 +30,10 @@ def create_connection_parameters( authenticator: Optional[str] = None, passcode: Optional[str] = None, passcode_in_password: Optional[bool] = None, -) -> Dict[str, str | bool]: - connection_parameters: Dict[str, str | bool] = dict(user=user, account=account) +) -> Dict[str, Union[str, bool]]: + connection_parameters: Dict[str, Union[str, bool]] = dict( + user=user, account=account + ) if password: connection_parameters["password"] = password if role: @@ -53,7 +55,9 @@ def create_connection_parameters( return connection_parameters -def _connection(connection_parameters: Dict[str, str | bool]) -> SnowflakeConnection: +def _connection( + connection_parameters: Dict[str, Union[str, bool]] +) -> SnowflakeConnection: # https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-connect return connect(**connection_parameters)