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:

  1. Set up a service account. You can name the account and ID anything you want.

../_images/service_account_step1.png

  1. Once the account is created, you should be able to see it under your project.

../_images/service_account_step2.png

  1. Go to the “Keys” tab in the service account.

../_images/service_account_step3.png

  1. Create a JSON key file for the service. You will be using this key file to establish a connection between Ponder and BigQuery.

../_images/service_account_step4.png

  1. (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.

../_images/create_dataset_step1.png

  1. (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.

../_images/create_dataset_step2.png

  1. 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 schema parameter.

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)