From 04aa358ec9943c0e247b625273cf19964f6ea52a Mon Sep 17 00:00:00 2001 From: Keshav Mohta <68001229+keshavmohta09@users.noreply.github.com> Date: Fri, 25 Apr 2025 19:55:50 +0530 Subject: [PATCH] fix: service connection config not getting updated with multiple project ids after ingestion (#20975) --- .../ingestion/source/database/bigquery/helper.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ingestion/src/metadata/ingestion/source/database/bigquery/helper.py b/ingestion/src/metadata/ingestion/source/database/bigquery/helper.py index e5123b9da5f..4da94293bfa 100644 --- a/ingestion/src/metadata/ingestion/source/database/bigquery/helper.py +++ b/ingestion/src/metadata/ingestion/source/database/bigquery/helper.py @@ -14,6 +14,7 @@ Source connection helper """ import re import traceback +from copy import deepcopy from typing import Any, List, Tuple from pydantic import BaseModel @@ -54,24 +55,25 @@ def get_inspector_details( """ # TODO support location property in JSON Schema # TODO support OAuth 2.0 scopes + new_service_connection = deepcopy(service_connection) kwargs = {} - if isinstance(service_connection.credentials.gcpConfig, GcpCredentialsValues): - service_connection.credentials.gcpConfig.projectId = SingleProjectId( + if isinstance(new_service_connection.credentials.gcpConfig, GcpCredentialsValues): + new_service_connection.credentials.gcpConfig.projectId = SingleProjectId( database_name ) - if service_connection.credentials.gcpImpersonateServiceAccount: + if new_service_connection.credentials.gcpImpersonateServiceAccount: kwargs[ "impersonate_service_account" ] = ( - service_connection.credentials.gcpImpersonateServiceAccount.impersonateServiceAccount + new_service_connection.credentials.gcpImpersonateServiceAccount.impersonateServiceAccount ) kwargs[ "lifetime" - ] = service_connection.credentials.gcpImpersonateServiceAccount.lifetime + ] = new_service_connection.credentials.gcpImpersonateServiceAccount.lifetime client = get_bigquery_client(project_id=database_name, **kwargs) - engine = get_connection(service_connection) + engine = get_connection(new_service_connection) inspector = inspect(engine) return InspectorWrapper(client=client, engine=engine, inspector=inspector)