Skip to content

Commit

Permalink
fix: impersonate service account for bq_dts has more scopes (#2083)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryscheng authored Sep 6, 2024
1 parent 5820906 commit 1ce9b73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions warehouse/oso_dagster/factories/bq_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
)
from dagster_gcp import BigQueryResource
from .common import AssetFactoryResponse
from ..constants import impersonate_service_account
from ..resources import BigQueryDataTransferResource
from ..utils import (
ensure_dataset,
Expand Down Expand Up @@ -72,6 +73,9 @@ def _bq_dts_asset(
)

with bigquery_datatransfer.get_client() as bq_dts_client:
context.log.info(
f"Ensuring BigQuery Data Transfer asset by impersonating {impersonate_service_account}"
)
ensure_bq_dts_transfer(bq_dts_client, asset_config, context.log)
context.log.info(
f"Ensured transfer config named {asset_config.display_name}"
Expand Down
7 changes: 6 additions & 1 deletion warehouse/oso_dagster/resources/bq_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
from pydantic import Field
from ..constants import impersonate_service_account

IMPERSONATE_SCOPES = ["https://www.googleapis.com/auth/bigquery"]
IMPERSONATE_SCOPES = [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/bigquery",
"https://www.googleapis.com/auth/bigquery.insertdata",
]
IMPERSONATE_LIFETIME = 300

"""
Expand Down

0 comments on commit 1ce9b73

Please sign in to comment.