노출 속성

노출 속성 (Exposure properties)

노출(exposure)은 properties.yml 파일의 exposures: 키 아래에 정의되는 리소스예요. 대시보드, 노트북, ML 모델 같은 다운스트림 소비자와 dbt 모델 사이의 연결을 선언해요.

출처: 문서

본문

노출은 properties.yml 파일에서 exposures: 키 아래에 중첩해서 정의해요. sourcesmodels도 정의하는 YAML 파일에서 exposures를 정의할 수 있어요. 노출 속성은 dbt_project.yml 파일이나 config() 블록으로는 구성할 수 없다는 점에서 "특수 속성"이에요. 자세한 내용은 Configs and properties를 참고하세요.

대부분의 노출 속성은 이 YAML 파일에 직접 구성해야 하지만, enabled 구성은 dbt_project.yml 파일의 프로젝트 레벨에서 설정할 수 있어요.

파일 이름은 whatever_you_want.yml처럼 지을 수 있고, models/ 디렉토리의 하위 폴더에 얼마든지 깊게 중첩할 수 있어요.

노출 이름은 문자, 숫자, 밑줄만 포함해야 해요 (공백이나 특수 문자 금지). 사람이 읽기 좋은 타이틀 케이스, 공백, 특수 문자가 필요하면 label 속성을 사용해요.

models/.yml

exposures:
  - name: <string_with_underscores>
    description: <markdown_string>
    type: {dashboard, notebook, analysis, ml, application}
    url: <string>
    maturity: {high, medium, low}  # Indicates level of confidence or stability in the exposure
    enabled: true | false
    config: # 'tags' and 'meta' changed to config in v1.10
      tags: [<string>] 
      meta: {<dictionary>}
      enabled: true | false
    owner: # supports 'name' and 'email' only
      name: <string>
      email: <string>
    
    depends_on:
      - ref('model')
      - ref('seed')
      - source('name', 'table')
      - metric('metric_name')
      
    label: "Human-Friendly Name for this Exposure!"

  - name: ... # declare properties of additional exposures

예시

models/jaffle/exposures.yml

exposures:

  - name: weekly_jaffle_metrics
    label: Jaffles by the Week              # optional
    type: dashboard                         # required
    maturity: high                          # optional
    url: https://bi.tool/dashboards/1       # optional
    description: >                          # optional
      Did someone say "exponential growth"?

    depends_on:                             # expected
      - ref('fct_orders')
      - ref('dim_customers')
      - source('gsheets', 'goals')
      - metric('count_orders')

    owner:
      name: Callum McData
      email: [email protected]

      
  - name: jaffle_recommender
    maturity: medium
    type: ml
    url: https://jupyter.org/mycoolalg
    description: >
      Deep learning to power personalized "Discover Sandwiches Weekly"
    
    depends_on:
      - ref('fct_orders')
      
    owner:
      name: Data Science Drew
      email: [email protected]

      
  - name: jaffle_wrapped
    type: application
    description: Tell users about their favorite jaffles of the year
    depends_on: [ ref('fct_orders') ]
    owner: { email: [email protected] }

프로젝트 레벨 구성

dbt_project.yml 파일의 exposures: 키 아래에서 + 접두어를 사용해 노출에 대한 프로젝트 레벨 구성을 정의할 수 있어요. 현재는 enabled 구성만 지원돼요:

dbt_project.yml

name: 'project_name'

# rest of dbt_project.yml

exposures:
  +enabled: true

더 알아보기 (Learn more)