|
4 | 4 | from functools import lru_cache |
5 | 5 | from typing import Any, Dict, Iterable, Optional, Tuple, Union |
6 | 6 |
|
7 | | -from google.auth import default |
| 7 | +from google.auth import default, load_credentials_from_file, load_credentials_from_dict |
8 | 8 | from google.auth.exceptions import DefaultCredentialsError |
9 | 9 | from google.auth.impersonated_credentials import Credentials as ImpersonatedCredentials |
10 | 10 | from google.oauth2.credentials import Credentials as GoogleCredentials |
11 | | -from google.oauth2.service_account import Credentials as ServiceAccountCredentials |
12 | 11 | from mashumaro import pass_through |
13 | 12 |
|
14 | 13 | from dbt_common.clients.system import run_cmd |
@@ -197,15 +196,15 @@ def _create_google_credentials(credentials: BigQueryCredentials) -> GoogleCreden |
197 | 196 | creds, _ = _create_bigquery_defaults(scopes=credentials.scopes) |
198 | 197 |
|
199 | 198 | elif credentials.method == _BigQueryConnectionMethod.SERVICE_ACCOUNT: |
200 | | - creds = ServiceAccountCredentials.from_service_account_file( |
| 199 | + creds, _ = load_credentials_from_file( |
201 | 200 | credentials.keyfile, scopes=credentials.scopes |
202 | 201 | ) |
203 | 202 |
|
204 | 203 | elif credentials.method == _BigQueryConnectionMethod.SERVICE_ACCOUNT_JSON: |
205 | 204 | details = credentials.keyfile_json |
206 | 205 | if _is_base64(details): # type:ignore |
207 | 206 | details = _base64_to_string(details) |
208 | | - creds = ServiceAccountCredentials.from_service_account_info( |
| 207 | + creds, _ = load_credentials_from_dict( |
209 | 208 | details, scopes=credentials.scopes |
210 | 209 | ) |
211 | 210 |
|
|
0 commit comments