Cubes backends provide ways of retrieving data and aggrgating them. The data access is provided through Store subclasses and aggregation through AggregationBrowser subclasses.
Store represents a connection to a database, caches metadata and knows how to retrieve the physical data.
Browser provides the core aggregation functionality on top of a physical schema. There might be multiple browsers in a backend, each handling different schemas, for example: snowflake schema, denormalized table or pre-aggregated star.
To implement custom backend:
The store type name will be derived from the class name. SQLStore will be called sql, MongoStore as mongo, SomeOtherStore as some_other.
Methods that the custom store is expected to implement:
It is highly recommended that the store provides a class variable named parameters which is a list of parameter description dictionaries. The list is used for properly configuring the store from end-user tools, such as Slicer. It also provides information about how to convert options into appropriate data types. Example:
class SQLStore(object):
parameters = [
{
"name": "schema",
"type": "string",
"description": "Database schema where tables are stored"
},
{
"name": "fact_prefix",
"type": "string",
"description": "Prefix for fact tables."
},
{
"name": "dimension_prefix",
"type": "string",
"description": "Prefix for dimension tables."
},
{
"name": "safe_labels",
"type": "bool",
"description": "Use safe column labels for constructed SQL "
"queries."
}
}
Note
Current use of the Store class is only as plug-in mechanism to find the store factory without need of explicit registration.
Methods to be implemented:
The browser class should provide two class variables:
For example:
class SQLSnowflakeBrowser(AggregationBrowser):
store_type = "sql"
schema_type = ("snowflake", "star")
def __init__(self, cube, store, locale=None):
# browser initialization...
Store is configured from one of:
Browser is configured from [browser] section of the main configuration file and from cube’s Cube.browser_options (former Cube.options) attribute.