I have 2 different projects in GCP.
I need to access BigQuery DataStore of Project-1. Have created the required Service Account Json Key.
Have written a Python Cloud Function in Project-2. I need to access BigQuery Data store of Project-1. as I understand, i need to retrieve the credentials from the service account json key file (from Project-1). Have uploaded the service account json key file in bucket storage of Project-2.
Am trying to retrieve the credentials from this Json key file. Have tried following different methods:
credentials = service_account.Credentials.from_service_account_file(filename,scopes='https://www.googleapis.com/auth/cloud-platform')
or
client = bigquery.Client.from_service_account_json(filename)
or
client = bigquery.Client.from_service_account_file(filename)
or
credentials = service_account.Credentials.from_service_account_info(service_account_info)
and I keep getting error,
[Errno 2] No such file or directory: filename
I have tried to give filename as URL or LinkURL or Public URL of the bucket Json file.
Please advise how we can access BigQuery of Project-1 from Cloud Function of Project-2 and I do have Service Account Json Key from Project-1.
client = bigquery.Client(credentials=credentials,project=credentials.project_id,)
#client = bigquery.Client.from_service_account_json(filetest)
from Python Cloud Function in Project 2 using Service Account Json Key of Project 1