Skip to main content

this

this is the database representation of the current model. It is useful when:

this is a Relation, and as such, properties such as {{ this.database }} and {{ this.schema }} compile as expected.

this can be thought of as equivalent to ref('<the_current_model>'), and is a neat way to avoid circular dependencies.

Examples#

Grant permissions on a model in a post-hook#

dbt_project.yml
models:  project-name:    +post-hook:      - "grant select on {{ this }} to db_reader"

Configuring incremental models#

models/stg_events.sql
{{ config(materialized='incremental') }}
select    *,    my_slow_function(my_column)
from raw_app_data.events
{% if is_incremental() %}  where event_time > (select max(event_time) from {{ this }}){% endif %}