exceptions
exceptions
exceptions 컨텍스트는 컴파일 과정에서 warning이나 error를 발생시키는 매크로를 제공해요. 매크로나 모델 안에서 조건이 맞지 않을 때 명시적으로 에러를 던지거나 경고를 표시할 수 있어요.
출처: 문서
본문
사용할 수 있는 주요 메서드는 다음과 같아요:
exceptions.warn(msg)— 경고(warning)를 발생시켜요.exceptions.raise_compiler_error(msg)— 컴파일 에러를 발생시켜 빌드를 중단해요.
예시:
{% if some_condition %}
{{ exceptions.raise_compiler_error("Something went wrong in this model") }}
{% endif %}
exceptions.warn은 경고만 남기고 계속 진행하게 하고, exceptions.raise_compiler_error는 실행을 에러로 종료해요.
더 알아보기 (Learn more)
- dbt 컨텍스트 전체는 dbt context variables를 참조하세요.