This guide describes the process of setting up Analytics over data stored in a BigQuery warehouse. The following are some quick links to the different procedures that you will need to follow during the setup:
Create a custom role
To enable Analytics to connect to and query your Google BigQuery database, you must create a custom role with specific permissions and assign it to the dedicated Analytics service account. You must have admin privileges in your project to complete the following steps.
- Sign in to console.cloud.google.com and select your project.
- Go to IAM & Admin > Roles.
- Click + Create Role and complete the following:
- Enter a title, description, and role ID (or use the existing ID).
- Select the appropriate role launch stage.
- Click + Add permissions and select the following permissions:
-
bigquery.config.get
-
bigquery.datasets.getIamPolicy
-
bigquery.jobs.create
-
bigquery.jobs.list
-
bigquery.savedqueries.get
-
bigquery.savedqueries.list
-
bigquery.tables.get
-
bigquery.tables.getData
-
bigquery.tables.list
-
resourcemanager.projects.get
-
- Click Add.
- Click Create.
Set up your service account
If you already have a service account for BigQuery, verify that the following permissions are granted to your account:
-
The service account has BigQuery Data Viewer permissions for the datasets you want to analyze with Analytics.
-
The service account has permissions for the
netspring_rw
dataset from the BigQuery Data Owner. -
The service account has permission to run jobs in the project through the BigQuery Job User role.
If you do not have a service account for BigQuery, create one using the following steps:
- Sign in to console.cloud.google.com and select your project.
- Go to IAM & Admin > Service Accounts > + Create Service Account.
- Enter a name and add an optional description.
- Click Create and continue.
- Click Select a role and select the custom role you recently created.
- Click Continue.
- Click Done.
Create a JSON key
- Select the service account you recently created.
- Go to Keys > Add key > Create new key.
- Select JSON as the key type.
- Click Create. The key is downloaded to your computer, and a confirmation message displays when the download is complete. Note the filename and click Close.
Share your dataset
- Sign in to console.cloud.google.com and select your project.
-
Go to BigQuery.
-
Ensure you are in the correct project, then select the dataset you want to share.
-
Click Share Dataset.
-
Enter the email address of the service account with which you want to share the dataset in the Add Members field.
-
Click Select a Role, choose Project Owner, and click Add.
-
Click Done.
Create a writable schema in BigQuery
To enhance query performance and reduce costs, create a writable schema specifically for Analytics.
First, create a dataset dedicated to Analytics:
- Sign in to console.cloud.google.com and select your project.
-
Go to BigQuery.
- Click View actions (...) for your project in the Explorer panel, and click Create dataset.
- Enter
netspring_rw
for the Dataset ID. - Ensure you use the same location type settings as your other datasets to minimize data movement costs.
- Click Create dataset.
Second, share write-access for this dataset with Analytics:
- Click View actions (...) for the
netspring_rw
dataset and select Share > Manage Permissions. - Click Add principal.
- Enter the service account email in New principals.
- Select BigQuery > BigQuery Data Editor for the Role.
- Click Save.
To enable Analytics to debug BigQuery performance issues, add the following role:
roles/bigquery.resourceViewer
Alternatively, you can directly grant the following privileges:
`bigquery.jobs.get`
`bigquery.jobs.listAll`
You also must add details of the schema in the Analytics application:
-
- Go to Settings in Analytics.
- Enable Materialization under General Settings and specify the following details:
- Database – The database name in the data warehouse where the materialized tables are created.
-
Schema – The schema's name within the database where the materialized tables are created. This value is
netspring_rw
. - Refresh Cron Schedule – The refresh periodicity of the materialized tables using the Cron syntax.
When this is done, Analytics creates materialized tables within the data warehouse that contain intermediate results to improve performance.
Please sign in to leave a comment.