this

this

this는 현재 모델의 데이터베이스 표현이에요. 다음과 같을 때 유용해요:

출처: 문서

본문

thisRelation이에요. 그래서 {{ this.database }}이나 {{ this.schema }} 같은 속성이 예상대로 컴파일돼요.

  • 참고 — dbt v1.6 이전에는 Studio IDE가 {{ ref.identifier }}의 결과로 request를 반환해요.

thisref('<the_current_model>')과 동등하다고 생각할 수 있고, 순환 의존성(circular dependency)을 피하는 깔끔한 방법이에요.

예시

Incremental 모델 구성하기

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 %}

더 알아보기 (Learn more)

  • this는 현재 모델 자신을 가리켜서 순환 참조 없이 자기 자신을 참조할 수 있어요.
  • 관련 개념: ref, incremental models.