Looker Studio
Prerequisites
warning
Follow installation instructions here
- You will need a Service Account with permissions to access Looker Studio. The instructions can be found here.
- You will also need to provide the email of a Google Workspace user with admin access.
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.
Run extraction script
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 similar to the 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
Command Arguments
Required Arguments
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 (e.g. ["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
You can always get help with the argument --help
Use ENV variables
You can set the following ENV variables in your .bashrc to avoid having to pass them as arguments:
CASTOR_LOOKER_STUDIO_ADMIN_EMAIL=admin@your-domain.com
CASTOR_OUTPUT_DIRECTORY=/tmp/catalog
GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials/service-account.json
Then the script can be executed without any arguments:
castor-extract-looker-studio
It can also be executed with partial arguments (the script looks in your ENV as a fallback):
castor-extract-looker-studio --output /tmp/catalog