modeling-dimension-tables
यह क्या करती है
यह स्किल वर्णनात्मक लुकअप टेबल बनाती है, जैसे देश, क्षेत्र, मुद्रा या प्लान, जिनसे दूसरी रिपोर्ट जुड़ती हैं। यह उन डेटा टीमों के लिए है जो अपने सभी विश्लेषण में एक जैसे लेबल चाहती हैं।
कब इस्तेमाल करें
- ✓जब आप अपने इवेंट या राजस्व को देश, क्षेत्र या प्लान के हिसाब से समूहित करना चाहें।
- ✓जब आपको एक साझा लुकअप टेबल चाहिए जिसे कई रिपोर्ट दोबारा इस्तेमाल कर सकें।
- ✓जब आप अपने मॉडल में मुद्रा या तारीख जैसी डाइमेंशन टेबल जोड़ना चाहें।
Skill का लिंक
https://github.com/PostHog/posthog/blob/master/products/data_modeling/skills/modeling-dimension-tables/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“देश और क्षेत्र की लुकअप टेबल बनाइए, ताकि मैं अपना राजस्व क्षेत्र के हिसाब से समूहित कर सकूँ।”
हर हफ़्ते 5 नई skills, 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
- लाइसेंस
- —
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
depot-ci
41kयह आपके एजेंट को Depot CI वर्कफ़्लो सेट अप करने, चलाने और माइग्रेट करने में मदद करती है, साथ ही रन के लॉग पढ़ने में।
depot-container-builds
41kयह आपके एजेंट को Depot के रिमोट बिल्डर पर Docker इमेज बनाने में मदद करती है, जिसमें मल्टी-प्लेटफ़ॉर्म इमेज और बिल्ड सुधार शामिल हैं।
depot-github-runners
41kयह आपके एजेंट को GitHub Actions जॉब Depot के मैनेज्ड रनर पर ले जाने, रनर का साइज़ और लेबल चुनने, और रनर सेटअप की समस्याएँ ठीक करने में मदद करती है।
editing-agents-md
41kयह आपके एजेंट को तय करने में मदद करती है कि कोई नियम AGENTS.md या CLAUDE.md में जाए या नहीं, और उसे ऐसे लिखे कि फ़ाइल भारी न हो।
मिलती-जुलती skills
discrawl
394kयह आपके एजेंट को Discord संदेशों के सेव किए गए स्थानीय आर्काइव में खोजने, उसका सारांश बनाने और उसकी ताज़गी जांचने में मदद करती है।
clickhouse-io
280kआपके एजेंट को ClickHouse databases में queries और schemas optimize करने में मदद करता है। high-performance analytical workloads के लिए best practices लागू करता है। जब analytical queries बहुत धीमी हों, तब इसका उपयोग करें।
scientific-db-pubmed-database
280kआपके एजेंट को बायोमेडिकल क्षेत्र के वैज्ञानिक लेख खोजने में मदद करता है। जिस रिसर्च में खास मेडिकल जानकारी चाहिए, उसके लिए यह काम का है।