diff --git a/.changes/unreleased/Fixes-20230322-150627.yaml b/.changes/unreleased/Fixes-20230322-150627.yaml new file mode 100644 index 000000000..90ef354f9 --- /dev/null +++ b/.changes/unreleased/Fixes-20230322-150627.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Enable single-line `private_key` for BigQuery Service Account JSON Authentication +time: 2023-03-22T15:06:27.761416-06:00 +custom: + Author: dbeatty10 + Issue: "7164" diff --git a/dbt/adapters/bigquery/connections.py b/dbt/adapters/bigquery/connections.py index 109e63c64..06da1ff90 100644 --- a/dbt/adapters/bigquery/connections.py +++ b/dbt/adapters/bigquery/connections.py @@ -158,6 +158,12 @@ class BigQueryCredentials(Credentials): "timeout_seconds": "job_execution_timeout_seconds", } + def __post_init__(self): + if self.keyfile_json and "private_key" in self.keyfile_json: + self.keyfile_json["private_key"] = self.keyfile_json["private_key"].replace( + "\\n", "\n" + ) + @property def type(self): return "bigquery"