Creating Cubes

The Cubes framework provides funcitonality for denormalisation and for cube pre-computation. Currently SQL backend supports denormalisation only and mongo backend supports cube precomputation.

Relational Database (SQL)

Following code will create a denormalized view (implemented as table) from a model and star/snowflake relational schema:

import sqlalchemy
import cubes

model = cubes.model_from_path("/path/to/model")

engine = sqlalchemy.create_engine(common.staging_dburl)
connection = engine.connect()
cube = model.cube("contracts")

builder = cubes.backends.SQLDenormalizer(cube, connection)
builder.create_materialized_view("mft_contracts")

connection.close()

See also

Module backends.
More information about cube builders in different database environments.
Module model.
Logical model description - required for preaggregated cube computation.

Table Of Contents

Previous topic

Aggregation Browsing and Aggregations

Next topic

Localization

This Page