Connecting to BigQuery

Overview

You can establish a direct connection to BigQuery to pull in data into xP&A.

 

This article contains a description of the prerequisites and the individual steps of the set-up process.

The fields that are pulled in must be defined during the set-up process using a database query. For a detailed instruction on how to structure such a query, see Defining Database Queries.

Limits for Data Imported from BigQuery

In order to prevent the accidental import of large amounts of data, there is a limit on the number of rows (150,000) and the number of items (100) you can have in a dimension when importing data from BigQuery.

Data sources that exceed these limits can negatively affect the performance of your model.

If you would like to remove these limits, please reach out to your Lucanet contact person.

 

To reduce the size of your data, aggregate it to the granularity you intend to use in xP&A (day, week, month) using SQL.

Prerequisites for the Setup
Creating a Google Service Account and Key

Before connecting to BigQuery, you need to create a Google service account and an associated key.

A service account is a special kind of account for non-human users. For more information, see Understanding Service Accounts. The key is required during the set-up process of the connection in xP&A.

You might need privileged access to your Google infrastructure in order to create a service account. For more information, see Create service accounts.

 

To create the service account in Google:

Open your Google Cloud Dashboard, and go to Service Accounts page.

Shows the Dasboard menu of Google Cloud. Highlighte dis the section "Service Accounts"
Google Service Accounts

Click + Create service account.

Enter a name and an ID for the service account and click Create and continue.

Shows the dialog 'Service account details'. Highlighted are the fields to enter the name and the ID of the account
Enter service account name and ID

Grant xP&A access to BigQuery by assigning the Role BigQuery Admin and click Continue.

Shows the dialog 'Grant this service accpunt access to project'. Highlighted is the dropdown menu 'Role' and the 'Continue' button
Assign 'BigQuery Admin' role

Go back to the Service Accounts page and click on the service account you just created. 

Open the Create key menu and choose Create new key.

Shows the details of the service account. Highlighted is the dropdown menu 'Add key' and the 'Create new key' option
Create new key

In the next dialog, slect JSON as key type and click Create to create and download the key.

Key type 'JSON'
Key type 'JSON'
Connecting to BigQuery

To connect to Postgres:

Choose one of the following options:

  • Open the Data workspace from the overview on the start page and click + New.
Shows the start page of Lucanet xP&A. Highlighted are the buttons that need to be used to create a new data source connection from the start page.
New data source connection from the Data workspace
  • Open the model into which you would like to integrate the data, click the + sign next to Data in the overview, and choose New data source:
Shows the view of a model. Highlighted are the buttons that need to be used to create a new data source connection from the model view.
New data source connection from within a model

In the Data sources dialog, open the BI/Database tab and choose BigQuery.

Shows the Data Sources dialog. Highlighted in red is the 'BI/Database' tab.
'BI/Database' tab

The New Data Source dialog is displayed as follows:

Shows the 'New Data Source' dialog for a BigQuery connection 'New Data Source' dialog for BigQuery

Configure the steps as described in the following section.

Click Create data source.

Set-up Steps

Step

Description


Choose a connection

Choose an existing connection, or, if you have not configured a connection yet, click New Connection and upload the JSON file you created for the Google service account (as described in Creating a Google Service Account and Key)

Upload file step
Uploading the JSON file

Complete the query form

Enter the following:

  • Data source name
  • Query to define the fields which are to be pulled in. For more information, see Defining Database Queries.
  • Name of the Date column, which must be one of BigQuery's date formats 
  • Names of the columns that contain variables (which must have a numeric data type.)

Any remaining columns will be treated as dimensions, and must have a string data type.

An exception is the cohort dimension, which must be a date, with the column header explicitly labelled Cohort.


Contact Us