snapshot_name
snapshot_name
snapshot_name은 스냅샷의 이름이에요. ref 함수로 스냅샷을 선택할 때 이 이름을 사용해요. 같은 프로젝트나 패키지에 정의된 다른 "ref 가능한" 리소스(모델, 시드, 다른 스냅샷)와 이름이 겹치면 안 되고, 파일 이름과 일치할 필요는 없어요. 그래서 스냅샷 파일 이름은 유일하지 않아도 돼요.
출처: 문서
본문
(dbt v1.9 이상 적용) snapshots/.yml
snapshots:
- name: snapshot_name
relation: source('my_source', 'my_table')
config:
schema: string
database: string
unique_key: column_name_or_expression
strategy: timestamp | check
updated_at: column_name # Required if strategy is 'timestamp'
Description
스냅샷의 이름으로, ref 함수를 사용해 스냅샷을 선택할 때 쓰여요.
이 이름은 이 프로젝트나 패키지에 정의된 다른 "ref 가능한" 리소스(모델, 시드, 다른 스냅샷)의 이름과 충돌하면 안 돼요.
이름은 파일 이름과 일치할 필요가 없어요. 그래서 스냅샷 파일 이름은 유일할 필요가 없어요.
Examples
스냅샷 이름을 order_snapshot으로 정하기
(dbt v1.9 이상 적용)
snapshots/order_snapshot.yml
snapshots:
- name: order_snapshot
relation: source('my_source', 'my_table')
config:
schema: string
database: string
unique_key: column_name_or_expression
strategy: timestamp | check
updated_at: column_name # Required if strategy is 'timestamp'
다운스트림 모델에서 이 스냅샷을 선택하려면:
select * from {{ ref('orders_snapshot') }}
더 알아보기 (Learn more)
- Snapshots — 스냅샷 기능 개요.
- ref function — 리소스 참조 방식.