Set Looker User Attributes
You can use Spectacles to control user attributes on a run-by-run basis. You can specify user attributes for runs triggered manually in the UI or for runs triggered via the Spectacles API. User attributes are also used for our dbt Cloud integration.
Setting user attributes
Before you can control user attributes in a Spectacles run, you need to set the default values for any user attributes you would like to use. Spectacles needs to know what value it should be reset to so that other runs aren't affected.
- In the top-right of the Spectacles app, click Settings ⚙️.
- Scroll down to the Looker Settings section.
- Under User attribute, input the name of the user attribute that you would like to be configurable in Spectacles.
- Under Default value, input the default value for the user attribute. If you're not sure, use the default value set in Looker.
- Click Update Settings.
Setting user attributes on a manual run
- In the top menu, click Suites.
- Click Create Run.
- Override any default user attribute values you want for this run.
- Click Start.
Setting user attributes on a API-triggered run
When creating a run via the Spectacles API, pass the user_attributes
key in the request body.
The value should be a dictionary of key-value pairs where the key is the name of the user attribute you would like to update and the value is the value it should be updated to:
{
"dbt_schema": "dbt_dylan",
"dbt_database": "staging"
}