Skip to content

Commit c525ab7

Browse files
authored
Merge pull request #7 from keboola/fix/publishing
Fix/publishing
2 parents 93bcccf + b64dbab commit c525ab7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/dbstorage/snowflake_client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _create_snfk_connection(self, config: dict, session_parameters: dict = None)
7070
auth_type = config.get("auth_type", "key_pair")
7171
logging.info(f"Using authentication type: {auth_type}")
7272

73-
if auth_type == "password":
73+
if auth_type != "key_pair" or not config.get("private_key"):
7474
try:
7575
connection = snowflake.connector.connect(
7676
user=config["user"],
@@ -110,7 +110,6 @@ def _create_snfk_connection(self, config: dict, session_parameters: dict = None)
110110
format=serialization.PrivateFormat.PKCS8,
111111
encryption_algorithm=serialization.NoEncryption(),
112112
)
113-
114113
try:
115114
connection = snowflake.connector.connect(
116115
user=config["user"],
@@ -126,9 +125,11 @@ def _create_snfk_connection(self, config: dict, session_parameters: dict = None)
126125
"Snowflake connection created successfully with key_pair authentication"
127126
)
128127
return connection
128+
129129
except Exception as e:
130130
logging.error(
131-
"Failed to create Snowflake connection with key_pair: %s", str(e)
131+
"Failed to create Snowflake connection with key_pair: %s",
132+
str(e),
132133
)
133134
raise
134135

0 commit comments

Comments
 (0)