Professional Documents
Culture Documents
Model or conguration
"cubes": [ { "name": "sales", "dimensions": ["product", "store"], "joins": [ {"master":"product_id", "detail":"product.id"}, {"master":"store_id", "detail":"store.id"} ] } ], "dimensions": [ { "name": "product", "attributes": ["code", "name"] }, { "name": "store", "attributes": ["code", "address"] } ]
fact table has same name as cube, dimension tables have same names as dimensions
2
store ...
"cubes": [ { ... "dimensions": ["product", "store", "year"], ... } ], "dimensions": [ ... { "name": "year" } ]
Python:
dim_store id code address ft_sales product_id store_id amount dim_product id code name
all dimension tables have prex dim_ and all fact tables have prex ft_
schema: sales_datamart
store id code address sales product_id store_id amount product id code name
dimensions
store id code address
facts
sales product_id store_id amount product id code name
all fact tables are stored in one schema, all dimension tables in another
Schema 6
store ... sales ... sales_year total_amount product ...
Model or conguration
"cubes": [ { "dimensions": [..., "year"], "measures": ["amount"], "mappings": { "year":"sales_year", "amount":"total_amount"] } } ], "dimensions": [ ... { "name": "year" } ]
at dimension is called year, but column is sales_year; measure is reported as amount, column is named total_amount
dim_suppliers ft_sales supplier_id client_id amount id name address dim_clients id name address dim_organisation id name address
clients and suppliers share one table with all organisations and companies
"cubes": [ { "name": "sales" "dimensions": ["supplier", "client"], "measures": ["amount"], "joins": [ { "master":"supplier_id", "detail":"dim_organisation.id", "alias":"dim_supplier" }, { "master":"client_id", "detail":"dim_organisation.id", "alias":"dim_client" } ] } ], "dimensions": [ { "name": "supplier", "attributes": ["id", "name", "address"] } { "name": "client", "attributes": ["id", "name", "address"] } ]
"cubes": [ { "dimensions": ["product", ...], "measures": ["amount"], "joins": [ {"master":"product_id", "detail":"product.id"} ] } ], "dimensions": [ { "name": "product", "levels": [ { "name":"category", "attributes": ["category_code", "category"] }, { "name":"product", "attributes": ["code", "name"] } ] } ]
Schema 9
key label
product id code name price
Model or conguration
"dimensions": [ { "name": "product", "levels": [ { "name": "product", "attributes": ["code", "name", "price"] "key": "code", "label_attribute": "name" } ] } ] Use: result = browser.aggregate(drilldown=["product"]) for row in result.table_rows("product"): print "%s: %s" % (row.label, row.record["amount_sum"])
aggregate or lter
report
Product coee tea milk Total Amount 200 250 50 500
attribute code to be used for aggregation, ltering or links and attribute name used as labels in user interface tables
10
Product ...
Amount ...
"cubes": [ { "name": "sales", "label": "Product Sales", "dimensions": ["product", ...] } ], "dimensions": [ { "name": "product", "label": "Product", "attributes": [ {"name": "code", "label": "Code"}, {"name": "name", "label": "Product"}, {"name": "price", "label": "Unit Price"}, ] } ]
11
(in dimensions) { "name":"date", "levels": [ { "name": "year", "attributes": ["year"] }, { "name": "quarter", "attributes": ["quarter"] }, { "name": "month", "attributes": ["month", "month_name"] }, { "name": "week", "attributes": ["week"] }, { "name": "weekday", "attributes": ["weekday"] }, { "name": "day", "attributes": ["day"] } ], "hierarchies": [ {"name": "ymd", "levels":["year", "month", "day"]}, {"name": "ym", "levels":["year", "month"]}, {"name": "yqmd", "levels":["year", "quarter", "month", "day"]}, {"name": "ywd", "levels":["year", "week", "weekday"]} ], "default_hierarchy_name": "ymd" }
dimension, such as date or geography, has multiple ways of organizing attributes into a hierarchy
Schema 12
product id code name_en name_fr name_es
Model or conguration
"dimensions": [ { "name": "product", "label": "Product", "attributes": [ {"name": "code", "label": "Code"}, { "name": "name", "label": "Product", locales: ["en", "fr", "es"] } ] } ]
dimension attributes have languagespecic content (requirement: one column per language, use locale sux)
Use:
! browser = workspace.browser(cube, locale=fr)
Then browse as usual. Localization is transparent. Notes: 1.only one locale per browser 2.refer to dimension attributes as there was no localisation: product.name 3.if non-existing locale is requested, then default (rst in the list) locale is used
Schema
{
sales product_id ... amount
Model or conguration
"locale": "en", "cubes": [ { "name": "sales", "label": "Product Sales", "dimensions": ["product"], "measures": [ {"name": "amount", "label": "Amount"} ] } ], "dimensions": [ { "name": "product", "label": "Product", "attributes": [ { "name": "code", "label": "Code" }, { "name": "name", "label": "Product", "locales": ["en", "sk"] }, { "name": "price", "label": "Unit Price" } ] } ] }
Product ...
Amount ...
Produkt ...
Suma ...
dimension attributes have languagespecic content; labels in report (including measures) should be displayed according to locale
Use:
! model_sk = model.localize(translation)
Warning: interface for model localization is not nal, might be changed in the future.