modeling-dimension-tables
하는 일
이 스킬은 다른 보고서가 조인하는 국가, 지역, 통화, 요금제 같은 설명용 조회 테이블을 만듭니다. 모든 분석에서 일관된 라벨을 원하는 데이터 팀을 위한 것입니다.
사용하는 경우
- ✓이벤트나 매출을 국가, 지역, 요금제별로 묶고 싶을 때.
- ✓여러 보고서가 재사용할 공유 조회 테이블이 필요할 때.
- ✓모델에 통화나 날짜 테이블 같은 차원을 추가하고 싶을 때.
스킬 링크
https://github.com/PostHog/posthog/blob/master/products/data_modeling/skills/modeling-dimension-tables/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“국가와 지역 조회 테이블을 만들어서 매출을 지역별로 묶을 수 있게 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 업로드한 파일, 동기화된 시스템, 또는 이벤트에서 보이는 값으로 조회 데이터를 가져옵니다. 항목당 한 행이 되도록 정리하고, 뷰로 저장한 뒤 묶기 위해 주 데이터와 조인합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Modeling dimension tables (star schema)
Dimensions are the descriptive tables (dim_country, dim_plan, dim_date) that fact tables join to for
slicing. This skill builds them once, cleanly, so every other model reuses them instead of re-deriving
lookups. Read modeling-warehouse-foundations first (joins + convertCurrency() live there). Catalog of
common dimensions: references/dimension-catalog.md; recipes in
references/posthog/ and references/dbt/.
Star schema in one screen
Facts (events, charges, revenue items) are long, keyed, and additive. Dimensions are short, one row per entity, descriptive. You model a dimension in three moves:
- Source it — where does the dimension data come from?
- Upload / seed a lookup (country→region, plan→tier) as a CSV (warehouse source or dbt seed).
- Sync it from a system of record (your app DB, Stripe products) as a warehouse source.
- Derive it from events (distinct countries seen, a plan property observed per person).
- Shape it — an aliased
SELECTwith clean column names, one row per entity (dedupe hard). Save as a view; materialize it on a slowsync_frequency(7day/30day) since dimensions change rarely and are read constantly. - Attach it — a saved join (dimension → a fact table) or person join (dimension → persons) so
its columns appear as native fields in any query, filter, or breakdown. See foundations
joins-and-dimensions.md.
Currency is already a managed dimension — don't build it
PostHog ships exchange rates behind convertCurrency(from, to, amount, timestamp?) (Open Exchange Rates,
historical-rate-correct). Use it directly for any money conversion. Only build a currency dimension yourself
in dbt (which has no equivalent), or if you need a rate provider PostHog doesn't offer.
Rules before you model
- One row per entity, unique key. A dimension with duplicate keys silently fan-outs every fact it joins.
Test uniqueness (PostHog: verify in the shaping query; dbt:
unique+not_null). - Drop NULL keys when you derive a dimension from events. HogQL keeps a row whose property is
missing when the filter only compares it to
'', so addisNotNull(...)as well. A NULL key becomes a dimension row of its own and it matches nothing on the fact side. - Alias to clean, stable names —
country_code,region,plan_tier. These names become the join surface everything else depends on. - Materialize static dimensions on a slow schedule; don't leave a constantly-read lookup virtual.
- Register and certify. Annotate the dimension and, if it's load-bearing, certify it in the catalog
(foundations
governance.md) so other models discover it and don't build a rival copy. - Prefer built-in currency (
convertCurrency) over a hand-rolled FX table on PostHog.
Build it
PostHog: shape an aliased dimension view, then materialize + join. Recipes:
references/posthog/dim_country.sql (derive + enrich from events),
dim_plan.sql (lookup/upload pattern).
dbt: conformed dim_* models with unique/not_null/relationships tests, plus a generated
dim_date. Recipes: references/dbt/.
File map
| File | Read when |
|---|---|
references/dimension-catalog.md |
Common dimensions, how to source each, and the natural key. |
references/posthog/ |
HogQL aliased-dimension view recipes. |
references/dbt/ |
dbt dim_date / dim_country + schema.yml tests. |
Companions
modeling-warehouse-foundations (joins + currency), setting-up-a-data-warehouse-source /
suggesting-data-imports (sync/upload the source data), and the models that consume these dimensions:
modeling-revenue-metrics, modeling-conversion-metrics, modeling-activation-metrics,
modeling-product-usage-metrics.
자주 묻는 질문
조회 데이터는 어디서 오나요?
업로드한 파일, 동기화하는 시스템, 또는 PostHog가 이벤트에서 보는 값에서 올 수 있습니다.
조회 테이블은 얼마나 자주 갱신되나요?
조회 테이블은 거의 바뀌지 않으므로, 주간이나 월간처럼 느린 일정에 따라 갱신됩니다.
스타 스키마란 무엇인가요?
이벤트나 결제 같은 주요 데이터 테이블이 그것을 설명하는 작은 조회 테이블에 연결되는 구조입니다.
상세 정보
작성자의 원본 설명
Build reusable dimension / lookup tables for a star schema — country/region, timezone, currency, date, plan/product, and other descriptive attributes — on either PostHog data-warehouse views (HogQL) or an external dbt project. Use when the user wants to model dimension tables, lookup tables, a star schema, conformed dimensions, or wants to enrich events/revenue/usage with country, region, timezone, plan, or currency attributes without repeating JOINs. Covers sourcing the dimension data (upload, warehouse source, or derive from events), shaping it into an aliased one-row-per-entity view (option
repo: PostHog/posthog
인기도
- GitHub 스타
- 41k
- 순위
- #6850
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
depot-ci
41k에이전트가 GitHub Actions 대안인 Depot CI 워크플로를 설정하고 실행하도록 돕습니다. 기존 워크플로 이전과 실행 로그 읽기를 포함합니다.
depot-container-builds
41k에이전트가 Depot 원격 빌더에서 Docker 이미지를 빌드하도록 돕습니다. 다중 플랫폼 이미지, 레지스트리 푸시, 빌드 실패 수정을 포함합니다.
depot-github-runners
41k에이전트가 GitHub Actions 작업을 Depot 관리형 러너로 옮기고, 러너 크기와 라벨을 고르도록 돕습니다.
editing-agents-md
41k에이전트가 규칙을 AGENTS.md나 CLAUDE.md 중 어디에 둘지 정하고, 파일을 키우지 않으면서 잘 지켜지도록 쓰게 돕습니다.
비슷한 스킬
discrawl
394k에이전트가 저장된 로컬 Discord 메시지 보관본을 검색하고 요약하며, 최신 상태를 확인하고 다이렉트 메시지를 읽도록 돕습니다.
clickhouse-io
280k에이전트가 ClickHouse 데이터베이스의 쿼리와 스키마를 최적화하도록 돕습니다. 고성능 분석 작업의 모범 사례를 적용합니다. 분석 쿼리가 느릴 때 씁니다.
scientific-db-pubmed-database
280k생의학 분야의 과학 논문을 에이전트가 검색하도록 돕습니다. 특정 의학 정보가 필요한 연구에 유용합니다.