Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery Anonymous Authentication #692

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20230502-215312.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: BigQuery Anonymous Credentials
time: 2023-05-02T21:53:12.042425893Z
custom:
Author: kpolley
Issue: "0"
5 changes: 5 additions & 0 deletions dbt/adapters/bigquery/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import google.cloud.exceptions
from google.api_core import retry, client_info
from google.auth import impersonated_credentials
from google.auth.credentials import AnonymousCredentials
from google.oauth2 import (
credentials as GoogleCredentials,
service_account as GoogleServiceAccountCredentials,
Expand Down Expand Up @@ -84,6 +85,7 @@ class BigQueryConnectionMethod(StrEnum):
SERVICE_ACCOUNT = "service-account"
SERVICE_ACCOUNT_JSON = "service-account-json"
OAUTH_SECRETS = "oauth-secrets"
ANONYMOUS = "anonymous-credentials"


@dataclass
Expand Down Expand Up @@ -321,6 +323,9 @@ def get_google_credentials(cls, profile_credentials) -> GoogleCredentials:
scopes=profile_credentials.scopes,
)

elif method == BigQueryConnectionMethod.ANONYMOUS:
return AnonymousCredentials()

error = 'Invalid `method` in profile: "{}"'.format(method)
raise FailedToConnectError(error)

Expand Down