User Attributes are arbitrary values that you can assign to a user, or a user can assign to themselves, that can then be used in other parts of Looker to provide custom experiences for each user.
Looker automatically includes some user attributes for you, including their email, first name, last name, full name, ID, and timezone (if configured).
Viewing User Attributes
To see your list of user attributes, go to the User Attributes page in the Admin section of Looker:
The table of user attributes contains the following values:
|Name||The name of the user attribute, as you’ll reference it in text-based areas of Looker like LookML|
|Label||The user-friendly name of the user attribute, as you’ll see it in parts of the Looker interface|
|Type||The type of the user attribute (string, number, date, yes/no, zipcode)|
|Actions||Any actions you can take for the user attribute. Note that some attributes will say “System Default”, which is the set of attributes that Looker automatically creates for each user.|
Creating User Attributes
To define a user attribute, click the Create User Attribute button at the upper left of the screen. Creating a user attribute requires two steps:
- Define the user attribute’s settings
- Assign values to the user attribute for sets of users or user groups
Defining a User Attribute
Each user attribute has the following settings:
- Name: The name of the User Attribute, for use in text-based environments such as LookML (can only use lowercase letters, numbers, and underscores).
- Label: The user-friendly version of the name. By default this will be the Name of the attribute, with underscores replaced with spaces, and each word capitalized. However, it can be modified as desired.
- Data Type: The type of the user attribute can be a string (words), number, datetime, yesno, or zipcode. This setting is used to check that valid values are being assigned to users for this user attribute.
- User Access: You can choose the level of visiblity and editing users have to a user attribute:
- Hidden: Will not appear on users’ account pages.
- Viewable: Will appear on users’ account pages, but will not be editable.
- Editable: Will appear on users’ account pages and can be set by the user.
- Hide Values: Even if user attributes are visible to users, they can still be masked, which is useful for passwords or other sensitive information. Keep in mind that once this value is set to “Yes”, it can never be changed back to “No”.
- Default Value: You can optionally set a default value to fall back on if a user has not had another value assigned to them.
Assigning Values to Groups and Users
Once a user attribute has been defined, values can be assigned to user groups and/or individual users using the Group Values and User Values tabs at the top of the page:
Assigning Values to Individual Users
To assign a value to an individual user, follow these steps:
- Click on User Values.
- Choose the user to which you want to assign a value in the dropdown menu. This will reveal a table of values that apply to that user.
- Click the Set Value for User button.
- Enter the value that you want the user to have in the New Value field.
- Click Save.
When a value is assigned to an individual user the value will always take precedence over any values assigned to that user’s groups.
Assigning Values to User Groups
To assign a value to an user group, follow these steps:
- Click on Group Values.
- Click the + Add Group button.
- Choose the group to which you want to assign a value in the dropdown menu.
- Enter the value that you want the group to have in the Value field.
- Click Save.
When a value is assigned to multiple groups you’ll need to decide which group should take precedence, in case a user belongs to multiple groups. To do so, drag the groups into the order that should apply; each group takes precedence over the groups listed below it.
For instance, in the example above, there is both an “Executive Team” and “Management Team” group. Executives are also managers, so they are a member of both groups. Dragging the “Executive Team” to the top of the list will ensure that its members are assigned the “Executive” value instead of the “Manager” value.
Where Can User Attributes be Used?
User attributes have the following functions:
The host, port, database, username, and password of a connection can each be given the value of an user attribute. This makes the connection specific to the user who runs a query.
Read more here: Parameterizing Connections with User Attributes
Please note that using user attributes on a connection will disable persistent derived tables for that connection.
Data Actions can be configured to include certain user attributes with their JSON payload. This can be useful for sending user-specific information along with the data, such as their credentials to perform an operation against a particular service.
Read more here: Data Actions with User Attributes
Filters on Explores, Looks, and Dashboards can be set to an user attribute in order to customize the query based on the user running it.
Read more here: Parameterized Filters with User Attributes
Dashboard filters can be set on a per-schedule basis, including the option to use an user attribute. This allows you to customize the dashboard results for each email recipient.
Read more here: Parameterized Dashboard Schedules with User Attributes
One of the ways you can limit the data that a user has access to is with access filters. This feature was previously implemented with the
access_filter_fields parameter, but is now more easily implemented with user attributes.
Read more here: Access Filters (with User Attributes)
LookML allows the use of several different Liquid variables, which can be useful for more complex types of customized output. A user’s attribute values can now be included in Liquid.
Read more here: Liquid Variables
Google BigQuery Data Limits
If you use Google BigQuery as your database you know that you are charged for each query, according to the size of the query. To help prevent users from accidentally running too expensive a query, you can apply a user attribute in the Max Billing Gigabytes setting in your BigQuery connection. The values that you supply in the user attribute should be the number of gigabytes that a user is allowed to pull in a single query.