시맨틱 모델 속성

시맨틱 모델 속성 (Semantic model properties)

시맨틱 모델은 MetricFlow가 시맨틱 그래프를 구축하는 데 사용하는 구조를 정의해요. 최신 스펙에서는 모델의 최상위 semantic_model: 블록으로 선언할 수 있고, 레거시 스펙에서는 독립 YAML을 사용했어요.

출처: 문서

본문

시맨틱 모델은 MetricFlow가 시맨틱 그래프를 구축하는 데 사용하는 구조를 정의해요. 최신 스펙에서는 모델의 최상위 semantic_model: 블록으로 선언할 수 있어요. 레거시 스펙에서는 독립 YAML을 사용했어요. 자세한 내용은 Semantic models를 참고해 주세요. 가용성 — 최신 YAML 스펙은 다음 환경에서 지원돼요:

  • dbt 플랫폼(v1 Latest 릴리스 트랙)
  • dbt v2
  • dbt v1.12

자세한 내용은 Migrate to the latest YAML spec을 참고해 주세요. (dbt v1.12 이상 적용)

Latest spec (model YAML)

최신 스펙에서 모델은 semantic_model 키로 시맨틱 모델을 정의하며, 그 값은 다음과 같을 수 있어요:

  • true 또는 false : 불리언 축약형. true는 시맨틱 모델을 활성화하고 모델의 이름을 시맨틱 모델 이름으로 사용해요(필드가 설정되지 않은 곳은 다른 기본값도 적용). false는 이 모델의 시맨틱 모델을 끄는 것이에요.
  • 매핑(mapping) : 아래 표와 같이 enabled, 선택적 name, group, config 등을 담은 객체.

디멘전과 엔티티는 컬럼과 함께 정의돼요.

Available semantic model properties (latest spec)

Property / location Type Required Description
semantic_model boolean or object 모델에 시맨틱 레이어를 쓸 때 true/false, 또는 매핑. 매핑을 쓸 때 선택적 키는 다음 행들.
semantic_model.enabled boolean No(매핑 형태) semantic_model이 매핑일 때 기본값 true. 비활성화하려면 false. semantic_model: true 또는 false를 쓸 때는 생략.
semantic_model.name string No 고유 이름; 기본값은 모델 이름. 이름에 이중 밑줄(__)은 피하세요. Semantic modelsName 참고.
semantic_model.group string No 조직화용 그룹.
semantic_model.config object No meta, group, enabled 지원.
agg_time_dimension (top-level) string Yes 메트릭의 기본 시간 디멘전; 디멘전 이름을 참조.
primary_entity (top-level) string No type: primary인 컬럼이 없을 때의 기본 엔티티 이름.
columns array Yes 컬럼 목록; 각각은 entity: 또는 dimension: 블록을 가질 수 있음; 시간 디멘전은 컬럼의 granularity를 가짐.
derived_semantics (top-level) object No expr을 가진 선택적 디멘전과 엔티티.
metrics (top-level) array No 이 시맨틱 모델에서 파생된 메트릭; 목록은 semantic_model과 나란히(semantic_model 아래가 아님).

Minimal structure example

models:
  - name: my_model
    semantic_model:
      enabled: true # explicit; defaults to true if omitted in mapping form
      name: optional_override # optional; defaults to model name
      group: optional_group
      config:
        meta: {}
      agg_time_dimension: my_time_dimension # top-level; references dimension name
      primary_entity: my_primary_entity # optional; use when no column has type: primary
      columns:
        - name: my_entity_column
          entity:
            type: primary
        - name: my_dimension_column
          dimension:
            type: categorical
        - name: my_time_dimension
          dimension:
            type: time
            granularity: day

더 알아보기 (Learn more)