Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions dbt/adapters/bigquery/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
from functools import lru_cache
from typing import Any, Dict, Iterable, Optional, Tuple, Union

from google.auth import default
from google.auth import default, load_credentials_from_file, load_credentials_from_dict
from google.auth.exceptions import DefaultCredentialsError
from google.auth.impersonated_credentials import Credentials as ImpersonatedCredentials
from google.oauth2.credentials import Credentials as GoogleCredentials
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
from mashumaro import pass_through

from dbt_common.clients.system import run_cmd
Expand Down Expand Up @@ -197,15 +196,15 @@ def _create_google_credentials(credentials: BigQueryCredentials) -> GoogleCreden
creds, _ = _create_bigquery_defaults(scopes=credentials.scopes)

elif credentials.method == _BigQueryConnectionMethod.SERVICE_ACCOUNT:
creds = ServiceAccountCredentials.from_service_account_file(
creds, _ = load_credentials_from_file(
credentials.keyfile, scopes=credentials.scopes
)

elif credentials.method == _BigQueryConnectionMethod.SERVICE_ACCOUNT_JSON:
details = credentials.keyfile_json
if _is_base64(details): # type:ignore
details = _base64_to_string(details)
creds = ServiceAccountCredentials.from_service_account_info(
creds, _ = load_credentials_from_dict(
details, scopes=credentials.scopes
)

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
"google-cloud-dataproc~=5.0",
# ----
# Expect compatibility with all new versions of these packages, so lower bounds only.
"google-auth>=2.20.0",
"google-api-core>=2.11.0",
# add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency
"dbt-core>=1.8.0",
Expand Down