Skip to main content

Looker Studio

Requirements

Warehouse Integration Required

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:

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:

Catalog Managed

1. Create Google Service Account for Catalog

Client creates a service account for Catalog from the Google Console. See how to create and manage service accounts.

Make sure to create and download a JSON key for that service account. See how to create service account keys.

Take note of the Service Account Client ID, also known as Unique ID.

2. Authorize the Google Service Account for Catalog

Authorize the service account for an organization. See how to authorize the app for Looker Studio.

The scopes to add are:

3. Add Credentials in Catalog App

Catalog Admin Required

You must be a Catalog admin to do it.

You can now enter the newly created credentials in the Catalog App at app.castordoc.com/settings/integrations.

  • Go to Settings > Integrations
  • Click on Looker Studio Add

Share the following credentials:

  • The JSON credentials of the service account created in step 1
  • The email of a Google Workspace user with admin access
Service Account Impersonation

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 or 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.
Extractor Package

For further details on our extractor PyPI package, see the castor-extractor installation instructions.

Run the 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 - Loading credentials from /looker/studio/credentials.json
INFO - Loading credentials 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

The required arguments depend on your extraction goal:

For a full Looker Studio extraction:

  • -c, --credentials: File path to Service Account credentials with Looker Studio access
  • -a, --admin-email: Email of a Google Workspace user with admin access

For source-queries-only mode:

  • -b, --bigquery-credentials: File path to Service Account credentials with BigQuery access

Optional Arguments

  • -o, --output: Directory to write the extracted files to
  • --source-queries-only: If selected, only extracts BigQuery source queries (bypasses Looker Studio extraction)
  • --skip-view-activity-logs: Skip extraction of activity logs (use if credentials lack required scopes)
  • --users-file-path: Optional path to a JSON file with user email addresses as a list of strings (for example, ["foo@bar.com", "fee@bar.com"]). If provided, only extracts assets owned by the specified users.
  • --db-allowed: Optional list of GCP projects to allow for source queries extraction
  • --db-blocked: Optional list of GCP projects to block from source queries extraction
Help

You can always get help with the argument --help.

Scheduling and Push to Catalog

When moving out of trial, you will want to refresh your Looker Studio content in Catalog. Here is how to do it:

The Catalog team will provide you with:

  1. Catalog Identifier (an id for us to match your Looker files with your Catalog instance)
  2. 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 DBT, VIZ, or WAREHOUSE

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
Directory Contents

The tool will upload all files included in the given directory.

Make sure it contains only the extracted files before pushing.

Then you will have to schedule the script run and the push to Catalog. Use your preferred scheduler to create this job.

You are done.