The Cubes framework provides funcitonality for denormalisation and for cube pre-computation. Currently SQL backend supports denormalisation only and mongo backend supports cube precomputation.
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