properties.yml 컨텍스트

properties.yml 컨텍스트 (properties.yml context)

properties.yml 파일에서 리소스를 구성할 때 사용할 수 있는 컨텍스트 메서드와 변수 목록이에요. 예를 들어 models/properties.yml에서 모델의 머티리얼라이즈 방식을 개발/운영 환경에 따라 다르게 설정할 수 있어요.

출처: 문서

본문

사용 가능한 컨텍스트 메서드 (Available context methods):

  • env_var
  • var

사용 가능한 컨텍스트 변수 (Available context variables):

  • target
  • builtins
  • dbt_version

예시 구성 (Example configuration)properties.yml:

# Configure this model to be materialized as a view
# in development and a table in production/CI contexts

models:
  - name: dim_customers
    config:
      materialized: "{{ 'view' if target.name == 'dev' else 'table' }}"

target.name을 참조해 개발 환경에서는 view로, 프로덕션/CI에서는 table로 머티리얼라이즈하도록 동적으로 구성한 예시예요.

더 알아보기 (Learn more)