How to Use Alli Client Credentials to Connect to Google Cloud (BigQuery)
Marketplace provides two environment variables related to Google Cloud which can be used to connect to Google Cloud and big query:
ALLI_GOOGLE_CLOUD_CREDENTIALS
this is a file path. The file contains credential info that can be passed intogoogle.auth.aws.Credentials
ALLI_GOOGLE_CLOUD_PROJECT
This is the project name and can be used to in big query connections and table namesALLI_GOOGLE_CLOUD_BIGQUERY_LOCATION
Where the bigquery data is located regionall (US
orEU
)
Python Example
import os
from google.auth import load_credentials_from_file
from google.cloud import bigquery
credentials, _ = load_credentials_from_file(os.environ['ALLI_GOOGLE_CLOUD_CREDENTIALS'])
bq = bigquery.Client(credentials=credentials, project=os.environ['ALLI_GOOGLE_CLOUD_PROJECT'])
datasets = list(bq.list_datasets())
print(datasets)