Google BigQuery¶
Google BigQuery is a fully-managed, serverless data warehouse that enables scalable analysis over petabytes of data. It is a Platform-as-a-Service (PaaS) that supports querying using ANSI SQL.
A View can be exported as a table to a BigQuery dataset on the Google Cloud Platform. For this export, you first need to configure Google Cloud. Here’s how to do this:
Enable BigQuery API¶
Log in to Google Cloud Platform and select the project to use in Mammoth;
Go to API and Services from the sidebar;
Click on + Enable APIs and Services and look for BigQuery API;
Open BigQuery API and click on Enable;
![]()
Fig. 144 Enabling BigQuery API¶
Create a Service Account¶
From the sidebar, select IAM & Admin and go to Service accounts;
Click on Create service account;
In Service Account Details, enter the service account name and description. Google Cloud will then choose an email for your service account randomly. Click on Create;
![]()
Fig. 145 Creating a service account¶
Click into Grant this service account access to project, add two roles and select BigQuery Data Editor and BigQuery Job User to give the service account permission to complete specific actions on the resources in your project. Click Continue;
In Grant users access to this service account, add the email address of the end user. By default, you will be the sole owner of the service account. This step is optional. Click Done;
![]()
Fig. 146 Adding roles to your service account.¶
For the newly created service account, go to the action menu and select Manage keys;
Select Add key and click on Create new key.
Select the key type as JSON (Mammoth accepts JSON type keys). Click on Create and a JSON key will be downloaded into your system. This JSON key will be required while connecting Mammoth to BigQuery.
![]()
Fig. 147 Creating a JSON key¶
Note
A service account can be used for multiple projects.
Switch to the project which needs this service account;
From the sidebar, go to IAM & Admin and click on +ADD;
Enter the email of the service account, create the roles and save the file.
![]()
Fig. 148 Adding a service account to a project¶
Connect Mammoth to BigQuery¶
In Mammoth, Select Data Preparation > Export > Google BigQuery.
Upload the JSON key which was downloaded in the previous step.
![]()
Fig. 149 Uploading the downloaded JSON key¶
Note
Make sure you have an existing Dataset in the Google Cloud project where the View can be exported as a table. To create a Dataset in BigQuery:
Go to Google Cloud Console;
Select Big Data > BigQuery from the sidebar;
Select your project from Explorer tab, and click Create Dataset.
Select the correct Dataset and enter the table name;
Validate the connection and click Apply once it turns green after the Validation. The table is then exported to the selected Dataset.
![]()
Fig. 150 Exporting the table to BigQuery Dataset¶
On the Google Cloud Platform, select Google BigQuery from the sidebar. Select the same project with the key and open the Dataset you had selected in Mammoth. The table exported from Mammoth should now appear.