BigQuery
Last updated
Last updated
Copyright 2023 Datawisp, Inc.
This guide will walk you through connecting Datawisp to your existing BigQuery datasets. We assume that you have an existing account on Google Cloud Platform (GCP) which is already storing data in BigQuery.
If you are importing a BigQuery dataset created by Google Analytics, please follow the GA-specific instructions: Google Analytics via BigQuery
We will begin by setting everything up on the GCP side. This is done using the Google Cloud Console. Before we begin, make sure that the right project is selected in the top left corner.
In the search box at the top of the page, search for and select BigQuery API (or click here) and make sure that it says API Enabled - otherwise click the "Enable" button
In the search box at the top of the page, search for and select Service Accounts (or click here).
Then click Create Service Account.
Pick an account name, ID, and description.
Make sure to copy the shown Email address and save it somewhere. You're going to need it later.
Then press Create and Continue.
Select the BigQuery Job User role. This will allow Datawisp to run queries in your BigQuery account.
Press Done.
In the list, select the service account you just created.
Go to Keys.
Click Create new key.
Keep JSON selected and click Create.
Note that your browser will now download a file. This file contains all the information required to log into the service account. You will need this later, so you can give Datawisp access to the service account.
If you are importing Google Analytics data, this step needs to be done differently.
Go to BigQuery.
Select the dataset you want to import to Datawisp.
Copy the dataset name and save it somewhere. You are going to need it later.
Then click Sharing->Permissions.
Click Add Principal.
Under New principals, paste the service account Email address that you saved previously.
Assign the BigQuery Data Viewer role. This will allow Datawisp to see all tables and views in the dataset.
Alternatively, you may choose to grant this role only on specific tables inside the dataset. In that case, you still need to grant the BigQuery Metadata Viewer role on the on the dataset. This will allow Datawisp to list (but not query) all tables in the dataset and is needed so that Datawisp can find the tables that it was granted access to.
Then click Save.
Head over to the Data Sources page and press Import.
Select Database and change the Connection type to Google BigQuery.
Choose a Title for the datasource.
For Service Account Credentials select the JSON file with the keys that you downloaded previously.
Under Dataset paste the dataset name that you copied previously.
In our example, it looks like this:
Then press Connect.
If everything worked, Datawisp will tell you that the connection to your BigQuery database was successful: