View the original community article here
Last tested: Mar 15, 2021
Reviewing the Liquid variables definitions we can see that the syntax when referencing user attributes is _user_attributes['name_of_attribute']
. When used in a liquid if tag evaluation we can use this variable directly. Below is an example of this in practice in a sql_always_where block. The literal example check's if the user's name user attribute is equal to value if so, it then it filters the specified field to be equal to the name user attribute value, otherwise no filtering occurs.
sql_always_where:
{% if _user_attributes['name'] == 'value' %}
${view_name.field_name}={{_user_attributes['name']}}
{% else %}
1=1
{% endif %} ;;
This content is subject to limited support.