- 08 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Looker Queries
- Updated on 08 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
- PDF
Looker API
Any instance where an entry in the below configuration has a leading $ represents a parameter that needs to be replaced with a static value.
Parameters in this document:
- $client_id and $client_secret - The Client ID and Client Secret will be used to authenticate calls to the Looker API. Documentation on how to generate both can be found here. You will want to be sure that the user that is used to create these credentials has the appropriate permission level to access the desired Looks to be ingested.
- $instance_name - The Looker Instance Name represents the API path for a given account. Documentation on how this can be created/found is provided here.
- $port - The Looker port will vary depending on the where the instance is hosted/when the instance was created, and documentation on how this can be created/found is provided here. Per Looker documentation, the following rules are used to define default path ports:
- Looker instances hosted on Google Cloud, Microsoft Azure use a port of
443
. - Looker instances hosted on AWS and created on or after 2020-07-07 use a port of
443
. - Looker instances hosted on AWS and created before 2020-07-07 use a port of
19999
.
- Looker instances hosted on Google Cloud, Microsoft Azure use a port of
- $look_title - This will represent the name of the Look to be ingested, which will need to be provided in full as well as being a unique name of a Look. This will be used to find the underlying query to be called and ingested.
- $report_description - The Report Description will be used in the Destination Table naming, and should be used to accurately describe the report you are ingesting. For example, if the report you've created is primarily used for gathering a variety of metrics grouped by country, you may utilize this parameter as
metrics_by_country
, thus making the full Destination Table namelooker_report_metrics_by_country
.
Connector configuration
- Base url: https://$instance_name.looker.com/api/4.0/queries/{identifier}/run/json
- Method: GET
- Destination: looker_$report_description
Destination table naming convention is ultimately up to you as the data owner. It is common that the Looker API table destination names are used to reflect the report that is being ingested (see $report_description details in the Configuration Parameters section above).
Variables
Variable name | Variable value |
---|---|
client_id | $client_id |
client_secret | $client_secret |
Refresh access token
- Enable:
- URL: https://$instance_name.looker.com:$port/api/4.0/login
- Method: POST
- URL Parameters: client_id={client_id}&client_secret={client_secret}
- Headers: {"Content-Type":"application/json"}
- Access token response key: access_token
- Use Bearer authentication:
- Error status codes: 401; 403
Fetch list
- Enable:
- Fetch List From: API
- Fetch url: https://$instance_name.looker.com/api/4.0/looks/search
- Method: GET
- URL Parameters: title=$look_title
- Data identifier key: query_id
- Use identifiers: As single value
Advanced Settings
The Primary Key can be either a single field or aggregation of fields that represent a unique identifier for the report being ingested. For example, if a report is collecting data that is metrics by country
, then the primary key will be {country}
However, if the report is metrics by country and age
, then the primary key will be {country}-{age}
.
Note: If no such field (or combination of fields) exist that represent a unique identifier, this field can be left empty, however you will want to be aware of the potential for duplicate records if no Primary Key is defined on the connector.