Looker Studio
Requirementsโ
A Warehouse type integration must already be configured to complete the first ingestion of this integration.
To get things started with Looker Studio you will need:
- To enable the Looker Studio API in the chosen GCP project
- To enable the Admin SDK API in the chosen GCP project
You will also need to create a Google Service Account, as such you need to have at minimum one of the following roles:
- ๐งโ๐ผ Service Account Admin
- ๐งโ๐ป Editor Basic
Finally, to give the needed rights to the service account you will need the following role:
- ๐งโ๐ผ Google Workspace Admin
If needed, whitelist Catalog IPโ
Here are our fixed IPs:
- For instances on app.us.castordoc.com :
34.42.92.72
- For instances on app.castordoc.com :
35.246.176.138
Catalog managedโ
1. Create Google Service Account for Catalogโ
Client creates a service account for Catalog from the Google Console. See how to here
Make sure to create and download a json key for that service account. See how-to here
Take note of the Service Account Cliend ID also known as Unique ID
2. Authorize the Google Service Account for Catalogโ
Authorize the service account for an organization. See how to here
The scopes to add are:
https://www.googleapis.com/auth/datastudio
https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/admin.reports.audit.readonly
https://www.googleapis.com/auth/admin.directory.user.readonly
3. Add credentials in Catalog Appโ
You must be Catalog admin to do it.
You can now enter the newly created credentials in the Catalog App here.
- Go to "Settings > Integrations"
- Click on "Looker Studio Add"
Share the following credentials:
- The JSON credentials of service account created in step 1
- The email of a Google Workspace user with admin access
The service account will impersonate this admin user in order to obtain the view activity of each Looker Studio asset. Rest assured that the service accountโs actions are limited by the scopes and IAM roles/permissions
- Combine both into this expected format:
{
"admin_email": "<str>",
"auth_provider_x509_cert_url": "<str>",
"auth_uri": "<str>",
"client_email": "<str>",
"client_id": "<str>",
"client_x509_cert_url": "<str>",
"private_key": "<str>",
"private_key_id": "<str>",
"project_id": "<str>",
"token_uri": "<str>",
"type": "<str>"
}
Client managedโ
Running the Extraction packageโ
Install the PyPi packageโ
pip install castor-extractor[lookerstudio]
Optional: BigQuery accessโ
If your Looker Studio data sources are connected to BigQuery:
- Make sure to install the BigQuery dependencies as well:
pip install castor-extractor[lookerstudio,bigquery]
- You will require a Service Account with BigQuery access. Consider using the Service Account linked to your BigQuery integration. Note that this can be the same Service Account as for Looker Studio, or a separate one.
For further details on our Extractor Pypi package: link
Running the PyPi package
Once the package has been installed, you should be able to run the following command in your terminal:
castor-extract-looker-studio [arguments]
The script will run and display logs as following:
INFO - Looker Studio credentials fetched from /looker/studio/credentials.json
INFO - BigQuery credentials fetched from /bigquery/credentials.json
INFO - Extracting ASSETS from API
INFO - Refreshing authentication token...
INFO - Refreshing authentication token...
...
INFO - Wrote output file: /tmp/ls/1742219344-summary.json
Credentialsโ
-c
,--credentials
: File path to Service Account credentials with Looker Studio access-a
,--admin-email
: Email of a Google Workspace user with admin access
Optional arguments
-b
,--bigquery-credentials
: Optional file path to Service Account credentials with BigQuery access. This can be the same file path as for Looker Studio.--users-file-path
: Optional path to a JSON file with user email addresses as a list of strings (e.g. ["foo@bar.com", "fee@bar.com"]). If provided, only extracts assets owned by the specified users.-o
,--output
: Directory to write the extracted files to
You can also get help with argument --help
Scheduling and Push to Catalogโ
When moving out of trial, you'll want to refresh your Looker Studio content in Catalog. Here is how to do it:
The Catalog team will provide you with
Catalog Identifier
(an id for us to match your looker files with your Catalog instance)Catalog Token
An API Token
You can then use the castor-upload
command:
castor-upload [arguments]
Argumentsโ
-k
,--token
: Token provided by Catalog-s
,--source_id
: account id provided by Catalog-t
,--file_type
: source type to upload. Currently supported are 0
Target filesโ
To specify the target files, provide one of the following:
-f
,--file_path
: to push a single file
or
-d
,--directory_path
: to push several files at once (*)
(*) The tool will upload all files included in the given directory.
Make sure it contains only the extracted files before pushing.
Then you'll have to schedule the script run and the push to Catalog, use your preferred scheduler to create this job
You're done!