Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Synopsis: Python framework and set of tools for building a heterogenous pluggable data warehouse, multidimensional data access and online
analytical processing (OLAP) of categorical data. Light weight.
Authors: Robin Thomas and Stefan Urbanek
Overview
Take your Google Analytics, and your SQL database, and you have a
single way for your users to access all of them. No need to grant
account access for everyone to each particular datasource.
sales
%
Workspace
"
Store
|
Browser
churn
BI Data
(Postgres)
activations
events
BI Data 2
Events
(Mongo)
(API)
[store_data]
type: sql
url: postgres://localhost/data
[store_data2]
type: mongo
host: localhost
[store_events]
type: mixpanel
api_key: 123456
api_secret: 123456
workspace = Workspace()
workspace.import_model(model.json)
workspace.register_default_store(sql, postgres://localhost/data)
Supported Backends:
analytical data
source data
API Model
Provider
Stores
Static Model
Provider
Cubes
Stores conguration:
Model Providers
#
Server
|
User Interface
Slicer
$
Authenticator
Model
dimension
id
sales
year
sale_date
month
product_id
code
product
store_id
address
id
amount
code
name
Denormalized
paths
Physical model
store
path
dimension
PointCut
"cubes": [
{
"name": "sales,
measures: [amount],
"dimensions": [date, product", "store"]
"joins": [
{"master:date_id, "detail:date.id"},
{"master":"product_id", "detail":"product.id"},
{"master":"store_id", "detail":"store.id"}
]
}
],
"dimensions": [
{ "name": "product", "attributes": ["code", "name"] },
{ "name": "store", "attributes": ["code", "address"] }
]
RangeCut
dimension
from
Drill-down
cell[level.label_attribute]
cell[level.key]
for URL
Summary
Logical
Physical
aggregate
AggregationResult
|
"
Browser
Store
model
result.summary
backend-specic
might hold a database cursor
facts
result.cells
iterable
pri
ce
measure
aggregate:
price_sum =
price
facts
cell[price_sum]
aggregate
result.summary
o cell = Cell(cube)
browser.aggregate(o cell)
browser.aggregate(o cell,
drilldown=[9 date])
result.cells
cut = PointCut(9 date, [2010])
o cell = o cell.slice( cut)
browser.aggregate(o cell,
drilldown=[9 date])
Slicer Server
Visualizers
Turning JSON data into reports, charts, tables. It is very easy to build
custom visualization on top of the Cubes analytical data with
framework of yor choice.
List cubes:
Slicer
GET /cubes
Cell
(point of view)
GET /cube/sales/model
facts
(details)
Aggregate:
Cubes
model
"cell": [],
"total_cell_count": 2,
"drilldown": [
{
"record_count": 31,
"amount_sum": 550840,
date.year": 2009
},
{
"record_count": 31,
"amount_sum": 566020,
date.year": 2010
}
],
"summary": {
"record_count": 62,
"amount_sum": 1116860
}
Slicer JSON response
/facts
get list of facts within a cell (if available)
/members list dimension members within a cell
/cell
get multi-dimensional breadcrumbs information,
browsing context or where am I looking at?
Ways of Deployment
HTML
HTTP request
JSON reply
Flask
Django, Flask,
Cubes
Python API
Web Application
HTML+JS, RoR,
Slicer Blueprint
JSON reply
model
model
Slicer server
store
model
store
Custom authorizer:
class CustomAuthorizer(Authorizer):
def authorize(self, cubes):
authorize with a database
return authorized_cubes
lidia: {
allowed_cubes: [sales],
cube_restrictions: {
sales: [store:3]
}
},
martin: {
allowed_cubes: [sales],
cube_restrictions: {
sales: [store:5]
}
}
Backends
SQL Backend
Bring your own aggregation engine. Take your Google Analytics, and
your SQL database, and you have a single way for your users to access
all of them. No need to grant account access for everyone to each
particular datasource.
Backend modules:
#
Model Provider
model
|
Browser
!
Store
OR
Cubes / Facts
Dimensions
Model
table
column (table)
required
MongoDB
collection
key/attribute
required
Mixpanel
event
property
automatic
Google Analytics
metric
dimension
automatic
cube
dimension
automatic
SQL
Cubes concepts:
Slicer
OR
subject category
subject
supplier
supplier type
contract
date
city
region
denormalization
data brewery.org
$ http://cubes.databrewery.org
% https://github.com/stiivi/cubes
& #databrewery at irc.freenode.net
Published for PyCon, April 2014, based on Cubes v1.0
geography dim.
date dim.