61
Cubes Light-weigth Online Analytical Processing Stefan Urbanek [email protected] @Stiivi April 2011

Cubes - Lightweight OLAP Framework

Embed Size (px)

DESCRIPTION

Cubes is light-weight online analytical processing (OLAP) framework and HTTP OLAP service server. Documentation: http://packages.python.org/cubes/

Citation preview

Page 1: Cubes - Lightweight OLAP Framework

CubesLight-weigth Online Analytical Processing

Stefan [email protected]@Stiivi

April 2011

Page 2: Cubes - Lightweight OLAP Framework

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

Introductioncubes, facts and dimensions

Page 4: Cubes - Lightweight OLAP Framework

data cube

data cell

Page 5: Cubes - Lightweight OLAP Framework

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

dimensions

location

type

time

Page 7: Cubes - Lightweight OLAP Framework

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

hierarchies

May

region

date

1st2010

Page 9: Cubes - Lightweight OLAP Framework

data mart

subject area

Page 10: Cubes - Lightweight OLAP Framework

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

Slicing and Dicing✂

Page 12: Cubes - Lightweight OLAP Framework

2010

2009

2008

2007

2006

spending in 2010

location

type

time

Page 13: Cubes - Lightweight OLAP Framework

Estonia

Poland

HungarySlovakia

Czech Republic

contracts in

Estonialocation

type

time

Page 14: Cubes - Lightweight OLAP Framework

location

type

time

contracts in

Estonia in 2010

Estonia 2010

Page 15: Cubes - Lightweight OLAP Framework

location

type

time

IT contracts

Page 16: Cubes - Lightweight OLAP Framework

location

type

time

IT contracts in

Estonia in 2010

Estonia 2010

IT✂

Page 17: Cubes - Lightweight OLAP Framework

measures can be aggregated

spending in 2010

revenue from IT

projects

top 10

contractors

Page 18: Cubes - Lightweight OLAP Framework

Drilling down

Page 19: Cubes - Lightweight OLAP Framework

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

looking at more detailed level

Page 21: Cubes - Lightweight OLAP Framework

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

Logical Modeldescription based on how you analyze data

Page 23: Cubes - Lightweight OLAP Framework

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

✶ star❄ snowflake

abstraction over physical data

Page 25: Cubes - Lightweight OLAP Framework

!

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

SlicerCubes OLAP server

Page 27: Cubes - Lightweight OLAP Framework

Slicer

Aggregation Browser

Cell(point of view)

facts(details)

∑ aggregates

Application

HTTP request

JSON reply

model

model

Page 28: Cubes - Lightweight OLAP Framework

GET /model{ "cubes": { "contracts": { "measures": [ { "name": "amount", "label": "Contract amount" } ], "dimensions": ["date", "supplier", "process_type", "cpv"] } }, "dimensions": { "supplier": { ... } } ...}

Page 29: Cubes - Lightweight OLAP Framework

GET /aggregateaggregate measures

Page 30: Cubes - Lightweight OLAP Framework

GET /aggregate

∑amount

Page 31: Cubes - Lightweight OLAP Framework

GET /aggregate

{ "drilldown": {}, "summary": { "record_count": 19278, "zmluva_hodnota_sum": 11222821530.12966 }}

Page 32: Cubes - Lightweight OLAP Framework

cut=...slice and dice with cut parameter

Page 33: Cubes - Lightweight OLAP Framework

GET /aggregate?cut=date:2010

∑amount

2010

Page 34: Cubes - Lightweight OLAP Framework

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

/aggregate?cut=date:2010|region:ee

∑amountEstonia

2010

Page 36: Cubes - Lightweight OLAP Framework

cut

cut=date:2010|region:es

dimension points

Page 37: Cubes - Lightweight OLAP Framework

dimension points

date:2010

region:ee

dimensionpath

Page 38: Cubes - Lightweight OLAP Framework

hierarchies

date:2010,12

dimensionpath

month level

year level

Page 39: Cubes - Lightweight OLAP Framework

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

cut

date:2010,12|category:it,sw|region:ee

pipe separates cuts

comma separates levels

Page 41: Cubes - Lightweight OLAP Framework

PUT /reportif you want multiple tables and charts with single

request

Page 42: Cubes - Lightweight OLAP Framework

drilldown=get more details

Page 43: Cubes - Lightweight OLAP Framework

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

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

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

drilldown=date,supplier

more dimensions:

for cross-tables

Page 47: Cubes - Lightweight OLAP Framework

Atributes and Measuresnaming

Page 48: Cubes - Lightweight OLAP Framework

dimensionattribute

category.description

date.yeardate.month

region.region_name

region.region_coderegion.city_name

Page 49: Cubes - Lightweight OLAP Framework

hierarchical attribute dependencies are implicit

defined in model

Page 50: Cubes - Lightweight OLAP Framework

there is no “date” data typedate components are normal attributes of

date dimension

month dayyear

Page 51: Cubes - Lightweight OLAP Framework

received_amount_sum

record_count

measure aggregation

Page 52: Cubes - Lightweight OLAP Framework

page=...&order=ordering and pagination

Page 53: Cubes - Lightweight OLAP Framework

page=3&pagesize=20

3rd page with 20 results per page

Page 54: Cubes - Lightweight OLAP Framework

order=region.nameorder by region name

order=amount:descorder by amount descending

Page 55: Cubes - Lightweight OLAP Framework

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

lang=transparent localization

Page 57: Cubes - Lightweight OLAP Framework

Localization

1

2

3

Page 58: Cubes - Lightweight OLAP Framework

+ +

master model translations

Page 59: Cubes - Lightweight OLAP Framework

drilldown=type&lang=endrilldown=type&lang=sk

report query is language independent

Page 60: Cubes - Lightweight OLAP Framework

Cubesonline analytical processing

github/bitbucket: Stiivi

Page 61: Cubes - Lightweight OLAP Framework

☛ References

[star] Christopher Adamson: Star Schema, 2010

and further reading