Created
July 21, 2016 18:02
-
-
Save Stiivi/706c19b1827e520cf06bc41597ee7213 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ----------------------- | |
DIMENSION city REFERENCES country | |
DIMENSION country REFERENCES region, market | |
DIMENSION region | |
DIMENSION market | |
DIMENSION agent REFERENCES market | |
DIMENSION company | |
REFERENCES | |
agent, | |
city AS billing_city | |
city AS hq_city | |
DIMENSION user | |
REFERENCES | |
city AS billing_city | |
city AS shipping_city | |
# Hierarchies | |
# ----------- | |
HIERARCHY geo (city, country, region) | |
HIERARCHY geo_market (city, country, market) | |
HIERARCHY agent_market (agent, market) | |
HIERARCHY company_billing_geo (company, *geo ON billing_city) | |
HIERARCHY company_hq_geo (company, *geo ON hq_city) | |
HIERARCHY company_hq_market (company, *geo_market ON hq_city) | |
HIERARCHY company_agent_market (company, agent, market) | |
# This is equivalent. We don't need to specify the 'ON' condition | |
# HIERARCHY company_agent_market (company, *agent_market) | |
HIERARCHY user_billing_geo (user, *geo ON billing_city) | |
HIERARCHY user_shipping_geo (user, *geo ON shipping_city) | |
REPR geo TABLE dim_geo PULL ALL | |
REPR x TABLE y PULL city.* | |
# fromclause_for_hierarchy(hier) | |
# Fact | |
# ---- | |
FACT sales | |
DIMENSIONS | |
company | |
city AS delivery_city | |
user | |
HIERARCHIES | |
geo ON delivery_city # going to be caled geo | |
# geo WHERE city IS delivery_city # going to be caled geo | |
company_hq_geo, | |
company_billing_geo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment