Skip to content

Commit 1d2315b

Browse files
authored
feat(snowflake): add oauth support (#2415)
1 parent 40a47fd commit 1d2315b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

soda/snowflake/soda/data_sources/snowflake_data_source.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,25 @@ def __init__(self, logs: Logs, data_source_name: str, data_source_properties: di
8888
self.session_parameters = data_source_properties.get("session_params")
8989

9090
self.passcode_in_password = data_source_properties.get("passcode_in_password", False)
91+
92+
# optional valid values: externalbrowser, SNOWFLAKE_JWT, OAUTH_CLIENT_CREDENTIALS
93+
self.authenticator = data_source_properties.get("authenticator", "snowflake")
94+
95+
# authenticator: SNOWFLAKE_JWT
9196
self.private_key_passphrase = data_source_properties.get("private_key_passphrase")
9297
self.private_key = data_source_properties.get("private_key")
9398
self.private_key_path = data_source_properties.get("private_key_path")
99+
# ----------------
100+
101+
# authenticator: OAUTH_CLIENT_CREDENTIALS
102+
self.oauth_client_id = data_source_properties.get("oauth_client_id")
103+
self.oauth_client_secret = data_source_properties.get("oauth_client_secret")
104+
self.oauth_token_request_url = data_source_properties.get("oauth_token_request_url")
105+
self.oauth_scope = data_source_properties.get("oauth_scope")
106+
# ----------------
107+
94108
self.client_prefetch_threads = data_source_properties.get("client_prefetch_threads", 4)
95109
self.client_session_keep_alive = data_source_properties.get("client_session_keep_alive", False)
96-
self.authenticator = data_source_properties.get("authenticator", "snowflake")
97110
self.session_params = data_source_properties.get("session_parameters")
98111

99112
self.host = data_source_properties.get("host")
@@ -126,6 +139,10 @@ def connect(self):
126139
client_prefetch_threads=self.client_prefetch_threads,
127140
authenticator=self.authenticator,
128141
application="Soda Core",
142+
oauth_client_id=self.oauth_client_id,
143+
oauth_client_secret=self.oauth_client_secret,
144+
oauth_token_request_url=self.oauth_token_request_url,
145+
oauth_scope=self.oauth_scope,
129146
**connection_parameters,
130147
)
131148

0 commit comments

Comments
 (0)