cubes - lightweight olap framework
DESCRIPTION
Cubes is light-weight online analytical processing (OLAP) framework and HTTP OLAP service server. Documentation: http://packages.python.org/cubes/TRANSCRIPT
![Page 2: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/2.jpg)
Features
■ logical model (metadata)
■ aggregated data browsing
■ OLAP HTTP server with json interface
■ data and metadata localization
■ multiple backends
![Page 3: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/3.jpg)
Introductioncubes, facts and dimensions
![Page 4: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/4.jpg)
data cube
data cell
![Page 5: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/5.jpg)
data cell
fact
most detailed
information
Fact examples:
• contract
• donation
• spending
• invoice
• project
• ...
measurable
measure examples:
• contract amount
• revenue
• duration
• price with VAT
![Page 6: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/6.jpg)
dimensions
location
type
time
![Page 7: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/7.jpg)
dimensionslocation
type
time
■ provide context for facts
■ used to filter queries or reports
■ control scope of aggregation of facts
■ used for ordering or sorting
■ define master-detail relationships
☛ [star]
![Page 8: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/8.jpg)
hierarchies
May
region
date
1st2010
![Page 9: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/9.jpg)
data mart
subject area
![Page 10: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/10.jpg)
Summary
■ fact – most detailed information for analysis
■ measure – an attribute for computation
■ dimension – context of facts
■ hierarchy – master-detail relationship
![Page 11: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/11.jpg)
Slicing and Dicing✂
✂
![Page 12: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/12.jpg)
2010
2009
2008
2007
2006
spending in 2010
location
type
time
![Page 13: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/13.jpg)
Estonia
Poland
HungarySlovakia
Czech Republic
contracts in
Estonialocation
type
time
![Page 14: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/14.jpg)
location
type
time
contracts in
Estonia in 2010
Estonia 2010
✂
✂
![Page 15: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/15.jpg)
location
type
time
IT contracts
![Page 16: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/16.jpg)
location
type
time
IT contracts in
Estonia in 2010
Estonia 2010
IT✂
✂
✂
![Page 17: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/17.jpg)
measures can be aggregated
spending in 2010
revenue from IT
projects
top 10
contractors
![Page 18: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/18.jpg)
Drilling down
![Page 19: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/19.jpg)
0
35
70
2006 2007 2008 2009 2010
6070
4050
30
0
125
250
All years
250
∑amount
drill down by date
∑amount
![Page 20: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/20.jpg)
looking at more detailed level
![Page 21: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/21.jpg)
0
35
70
2006 2007 2008 2009 2010
6070
4050
30
0
125
250
All years
250
0
3,5
7
Jan Feb Mar Apr March April May ...1
3
7
1
54
23
top level
year level
month level
![Page 22: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/22.jpg)
Logical Modeldescription based on how you analyze data
![Page 23: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/23.jpg)
Logical Modeluser’s or analyst’s perspective:
how data are being
measured, aggregated and reported
24%
28% 16%
20%
12%∑amountamount
![Page 24: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/24.jpg)
✶ star❄ snowflake
abstraction over physical data
![Page 25: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/25.jpg)
!
Legend:"#localizable!#required during cube creation
and denormalisation$#required by browser
description "
default hierarchy
label "name
Dimension
detailsfact table !
measures
description "label "name
Cube
label "name
Hierarchy
label attributekey attribute
label "name
Level
description "locales !$
label "name
Attribute
locale
description "label "name
Model
masterdetailalias
Join !
masterdetail
Mapping !
![Page 26: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/26.jpg)
SlicerCubes OLAP server
![Page 27: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/27.jpg)
Slicer
Aggregation Browser
Cell(point of view)
facts(details)
∑ aggregates
Application
HTTP request
JSON reply
model
model
![Page 28: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/28.jpg)
GET /model{ "cubes": { "contracts": { "measures": [ { "name": "amount", "label": "Contract amount" } ], "dimensions": ["date", "supplier", "process_type", "cpv"] } }, "dimensions": { "supplier": { ... } } ...}
![Page 29: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/29.jpg)
GET /aggregateaggregate measures
![Page 30: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/30.jpg)
GET /aggregate
∑amount
![Page 31: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/31.jpg)
GET /aggregate
{ "drilldown": {}, "summary": { "record_count": 19278, "zmluva_hodnota_sum": 11222821530.12966 }}
![Page 32: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/32.jpg)
cut=...slice and dice with cut parameter
![Page 33: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/33.jpg)
GET /aggregate?cut=date:2010
∑amount
✂
2010
![Page 34: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/34.jpg)
GET /aggregate?cut=date:2010✂
2010
{ "drilldown": {}, "summary": { "date.year": 2011, "record_count": 64, "zmluva_hodnota_sum": 78717997.108
}}
![Page 35: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/35.jpg)
/aggregate?cut=date:2010|region:ee
∑amountEstonia
2010
✂
✂
![Page 36: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/36.jpg)
cut
cut=date:2010|region:es
dimension points
![Page 37: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/37.jpg)
dimension points
date:2010
region:ee
dimensionpath
![Page 38: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/38.jpg)
hierarchies
date:2010,12
dimensionpath
month level
year level
![Page 39: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/39.jpg)
more hierarchies
date:2010,12|category:it,sw|
region:ee
contracts in December 2010
in Estonia for IT – Software
![Page 40: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/40.jpg)
cut
date:2010,12|category:it,sw|region:ee
pipe separates cuts
comma separates levels
![Page 41: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/41.jpg)
PUT /reportif you want multiple tables and charts with single
request
![Page 42: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/42.jpg)
drilldown=get more details
![Page 43: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/43.jpg)
0
35
70
2006 2007 2008 2009 2010
6070
4050
30
0
125
250
All years
250
∑amount
∑amount
drilldown=date
![Page 44: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/44.jpg)
0
35
70
2006 2007 2008 2009 2010
6070
4050
30
0
125
250
All years
250
0
3,5
7
Jan Feb Mar Apr March April May ...1
3
7
1
54
23
drilldown=date
cut=date:2010 &drilldown=date
implicit
hierarchy
![Page 45: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/45.jpg)
drilldown=date
drilldown=date&cut=date:2010
drilldown=date&cut=date:2010,11
report by year:
report by month:
report by day:
![Page 46: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/46.jpg)
drilldown=date,supplier
more dimensions:
for cross-tables
![Page 47: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/47.jpg)
Atributes and Measuresnaming
![Page 48: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/48.jpg)
dimensionattribute
category.description
date.yeardate.month
region.region_name
region.region_coderegion.city_name
![Page 49: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/49.jpg)
hierarchical attribute dependencies are implicit
defined in model
![Page 50: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/50.jpg)
there is no “date” data typedate components are normal attributes of
date dimension
month dayyear
![Page 51: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/51.jpg)
received_amount_sum
record_count
measure aggregation
![Page 52: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/52.jpg)
page=...&order=ordering and pagination
![Page 53: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/53.jpg)
page=3&pagesize=20
3rd page with 20 results per page
![Page 54: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/54.jpg)
order=region.nameorder by region name
order=amount:descorder by amount descending
![Page 55: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/55.jpg)
Natural Ordering
attributes can have default order specified in model
order=year:asc
... might be omitted if model contains:
{“name” = “year”, “order” = “asc”}
![Page 56: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/56.jpg)
lang=transparent localization
![Page 57: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/57.jpg)
Localization
1
2
3
![Page 58: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/58.jpg)
+ +
master model translations
![Page 59: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/59.jpg)
drilldown=type&lang=endrilldown=type&lang=sk
report query is language independent
![Page 60: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/60.jpg)
Cubesonline analytical processing
github/bitbucket: Stiivi
![Page 61: Cubes - Lightweight OLAP Framework](https://reader034.vdocument.in/reader034/viewer/2022050804/549104ebb47959ef508b4611/html5/thumbnails/61.jpg)
☛ References
[star] Christopher Adamson: Star Schema, 2010
and further reading