BigQuery Connection Methods#
Service Account Key Authentication#
To establish a connect with Ponder, you need to set up your own BigQuery service account for testing Ponder and get the service key file. You can follow this guide to set up a service account or follow the step-by-step instructions below:
Set up a service account. You can name the account and ID anything you want.
Once the account is created, you should be able to see it under your project.
Go to the “Keys” tab in the service account.
Create a JSON key file for the service. You will be using this key file to establish a connection between Ponder and BigQuery.
(Optional) If you don’t already have a dataset that you’re using. You can create a Dataset in your service account by following this guide.
(Optional) Here we create a dataset named
PONDER. Again, you can name the dataset anything you want. Note down the dataset name as we will use this information to establish the connection.
To establish connection to BigQuery, you first need to create a Ponder BigQuery connections object. Note that here you list the name of the dataset you’re working with in the
import ponder.bigquery # Load your BigQuery service account key file creds = json.load(open(os.path.expanduser("your_bigquery_key.json"))) # Initialize the BigQuery connection bigquery_con = ponder.bigquery.connect(creds, schema = "<dataset-name>")
After you have created the BigQuery connection, you can initialize the connection as following:
# Initialize the BigQuery connection ponder.bigquery.init(bigquery_con)