| Cubes | |
|---|---|
| Original author | Stefan Urbanek[1] |
| Initial release | March 27, 2011; 14 years ago (2011-03-27) |
| Stable release | 1.1 / July 2, 2016; 9 years ago (2016-07-02) |
| Written in | Python |
| Operating system | Cross-platform |
| Type | OLAP |
| License | MIT License[2] |
| Website | cubes |
| Repository | github |
Cubes is a light-weightopen source multidimensional modelling andOLAP toolkit for development reporting applications and browsing of aggregated data written inPython programming language released under theMIT License.
Cubes provides to an analyst or any application end-user "understandable and natural way of reporting using concept ofdata Cubes – multidimensional data objects".
Cubes was first publicly released in March 2011. The project was originally developed forPublic Procurements ofSlovakia.[3] Cubes 1.0 was released in September 2014 and presented on the PyData Conference in New York[4]
Cubes is capable of handling large amounts of data and complex queries. According to a review by TechTarget, Cubes can handle "data volumes in the hundreds of millions of rows" and "complex queries and calculations that require multi-level aggregations and dynamic subsetting." Additionally, the review notes that Cubes is well-suited for smaller organizations or teams that don't require the complexity and scalability of enterprise-level OLAP solutions.[5]
The logical conceptual model in Cubes is described usingJSON and can be provided either in a form of a file, directory bundle or from an external model provider (for example a database). The basic model objects are:cubes and their measures and aggregates, dimensions and their attributes, hierarchies. Logical model also contains mapping from logical attributes to their physical location in a database (or other data source).
Example model:
{"cubes":[{"name":"sales","label":"Our Sales","dimensions":["date","customer","location","product"],"measures":["amount"]}]"dimensions":[{"name":"product","label":"Product","levels":[{"name":"category","label":"Category","attributes":["category_id","category_label"],},{"name":"product","label":"Product","attributes":["product_id","product_label"],}]},...]}
Cubes provides basic set of operations such asData drilling and filtering (slicing and dicing). The operations can be accessed either through Python interface or through a lightweb server called Slicer.
Example of the python interface:
importcubesworkspace=Workspace("slicer.ini")browser=workspace.browser("sales")result=browser.aggregate()print(result.summary)
The Cubes provides a non-traditional OLAP server withHTTP queries andJSON responseAPI. Example query to get "total amount of all contracts between January 2012 and June 2016 by month":
http://localhost:5000/cube/contracts/aggregate?drilldown=date&drilldown=criteria&cut=date:2012,1-2012,6&order=date.month:desc
The response looks like:
{"summary":{"contract_amount_sum":10000000.0},"remainder":{},"cells":[{"date.year":2012,"criteria.code":"ekonaj","contract_amount_sum":12345.0,"criteria.description":"economically best offer","criteria.sdesc":"best offer","criteria.id":3},{"date.year":2012,"criteria.code":"cena","contract_amount_sum":23456.0,"criteria.description":"lowest price","criteria.sdesc":"lowest price","criteria.id":4},..."total_cell_count":6,"aggregates":["contract_amount_sum"],"cell":[{"type":"range","dimension":"date","hierarchy":"default","level_depth":2,"invert":false,"hidden":false,"from":["2012","1"],"to":["2015","6"]}],"levels":{"criteria":["criteria"],"date":["year"]}}
The simple HTTP/JSON interface makes it very easy to integrate OLAP reports in web applications written in pureHTML andJavaScript.
The Slicer server contains endpoints describing thecube metadata which helps to create generic reporting applications[6] that don't have to know the database model structure and conceptual hierarchies up-in-front.
The Slicer server is written using theFlask (web framework).
The built-inSQL backend of the framework providesROLAP functionality on top a relational database. Cubes contains aSQL query generator that translates the reporting queries into SQL statements. The query generator takes into accounttopology of thestar orsnowflake schema and executes only joins that are necessary to retrieve attributes required by the data analyst.
The SQL backend usesSQLAlchemy Python toolkit to construct the queries.