Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 1349974

Browse files
committed
add draft changes for addl conn_types
1 parent 13f9beb commit 1349974

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

data_diff/dbt.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ def set_connection(self):
268268
# values can contain env_vars
269269
rendered_credentials = ProfileRenderer().render_data(credentials)
270270

271+
# this whole block should be refactored/extracted to method(s)
271272
if conn_type == "snowflake":
272273
if rendered_credentials.get("password") is None or rendered_credentials.get("private_key_path") is not None:
273274
raise Exception("Only password authentication is currently supported for Snowflake.")
@@ -293,6 +294,37 @@ def set_connection(self):
293294
"project": rendered_credentials.get("project"),
294295
"dataset": rendered_credentials.get("dataset"),
295296
}
297+
# untested
298+
elif conn_type == "redshift":
299+
conn_info = {
300+
"driver": conn_type,
301+
"host": rendered_credentials.get("host"),
302+
"user": rendered_credentials.get("user"),
303+
"password": rendered_credentials.get("password"),
304+
"port": rendered_credentials.get("port"),
305+
"dbname": rendered_credentials.get("dbname")
306+
}
307+
# untested
308+
elif conn_type == "databricks":
309+
conn_info = {
310+
"driver": conn_type,
311+
"catalog": rendered_credentials.get("catalog"),
312+
"server_hostname": rendered_credentials.get("host"),
313+
# TODO may need to trim the / at http_path[0]
314+
"http_path": rendered_credentials.get("http_path"),
315+
"schema": rendered_credentials.get("schema"),
316+
"access_token": rendered_credentials.get("token")
317+
}
318+
# untested
319+
elif conn_type == "postgres":
320+
conn_info ={
321+
"driver": "postgresql",
322+
"host": rendered_credentials.get("host"),
323+
"user": rendered_credentials.get("user"),
324+
"password": rendered_credentials.get("password"),
325+
"port": rendered_credentials.get("port"),
326+
"dbname": rendered_credentials.get("dbname") or rendered_credentials.get("database"),
327+
}
296328
else:
297329
raise NotImplementedError(f"Provider {conn_type} is not yet supported for dbt diffs")
298330

0 commit comments

Comments
 (0)