Skip to content

Commit

Permalink
Enable single-line private_key for BigQuery Service Account JSON Au…
Browse files Browse the repository at this point in the history
…thentication (#625)

* Enable single-line `private_key` for BigQuery Service Account JSON Authentication

* Use post-init processing to handle single-line `private_key`s
  • Loading branch information
dbeatty10 authored Jul 7, 2023
1 parent 2fb5681 commit c36c902
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230322-150627.yaml
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 6 additions & 0 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c36c902

Please sign in to comment.