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

Commit 5614725

Browse files
committed
simplify
1 parent 7104319 commit 5614725

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

data_diff/dbt_parser.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -297,33 +297,24 @@ def set_connection(self):
297297
else:
298298
raise DataDiffDbtSnowflakeSetConnectionError("Snowflake: unsupported auth method")
299299
elif conn_type == "bigquery":
300-
supported_methods = {
301-
"oauth": {
302-
"conn_info": {
303-
"driver": conn_type,
304-
"project": credentials.get("project"),
305-
"dataset": credentials.get("dataset"),
306-
}
307-
},
308-
"service-account": {
309-
"conn_info": {
310-
"driver": conn_type,
311-
"project": credentials.get("project"),
312-
"dataset": credentials.get("dataset"),
313-
"keyfile": credentials.get("keyfile"),
314-
}
315-
},
316-
}
300+
supported_methods = ["oauth", "service-account"]
317301
method = credentials.get("method")
318302
# there are many connection types https://docs.getdbt.com/reference/warehouse-setups/bigquery-setup#oauth-via-gcloud
319303
# this assumes that the user is auth'd via `gcloud auth application-default login`
320304
if method not in supported_methods:
321305
raise DataDiffDbtBigQueryUnsupportedMethodError(
322-
f"Method: {method} is not in the current methods supported for Big Query ({supported_methods.keys()})."
306+
f"Method: {method} is not in the current methods supported for Big Query ({supported_methods})."
323307
)
324308

325-
conn_info = supported_methods[method]["conn_info"]
309+
conn_info = {
310+
"driver": conn_type,
311+
"project": credentials.get("project"),
312+
"dataset": credentials.get("dataset"),
313+
}
314+
326315
self.threads = credentials.get("threads")
316+
if method == supported_methods[1]:
317+
conn_info["keyfile"] = credentials.get("keyfile")
327318

328319
elif conn_type == "duckdb":
329320
conn_info = {

0 commit comments

Comments
 (0)