Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use union syntax for type hints #113

Merged
merged 1 commit into from
Jul 30, 2024
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
12 changes: 8 additions & 4 deletions semantic_model_generator/snowflake_utils/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)

Expand Down
Loading