> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lightdash.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SQL variables

> Reference variables that template the SQL in your models and make it reusable

* `${field}` - reference a field in the current model
* `${model.field}` - reference a field in another model
* `${TABLE}` - reference the current table's sql reference
* `${lightdash.attributes.my_attr_1}` - a user attribute called `my_attr_1`
  * (optional) `ld` as an alias for `lightdash`
  * (optional) `attribute` or `attr` as an alias for `attributes`
* `${lightdash.user.<intrinsic_attribute>}` - reference an `intrinsic_attribute` of the current Lightdash user
  * (optional) `ld` as an alias for `lightdash`
  * available intrinsic user attributes:
    * `email`

<Info>
  **The user email attribute is only available when the email is verified.**

  This is a security measure to prevent users from creating/updating an account with any email they don't own and gain access to data they shouldn't see.

  If the user email is not verified you will get the following error:

  <Frame>
    <img src="https://mintcdn.com/lightdash/JdILkiMOelIPzB-o/images/user-attributes-info.png?fit=max&auto=format&n=JdILkiMOelIPzB-o&q=85&s=46b0c28f382bcb1a46a267cd6e3ee97a" alt="" width="438" height="72" data-path="images/user-attributes-info.png" />
  </Frame>

  ```yaml theme={null}
  models:
    - name: example
      meta:
        sql_filter: ${lightdash.user.email} = 'example@lightdash.com'
  ```

  If you are self hosting you can enable [SMTP](/self-host/customize-deployment/environment-variables#smtp) or [SSO](/self-host/customize-deployment/use-sso-login-for-self-hosted-lightdash) authentication to allow users to verify their email address.
</Info>
