Skip to main content

property Cube.feeding : Literal[‘enabled’, ‘disabled’]

Whether the cube is fed from the database. When "disabled", hierarchies have no members, aggregate providers are empty, etc. Queries thus return empty results. This is useful to avoid paying the cost of feeding until the entire data model is defined.
>>> df = pd.DataFrame(
...     columns=["Product", "Quantity"],
...     data=[
...         ("phone", 600),
...         ("watch", 1000),
...     ],
... )
>>> table = session.read_pandas(df, table_name="Sales")
Feeding is enabled by default:
>>> cube = session.create_cube(table)
>>> cube.feeding
'enabled'
Recreating the cube with feeding disabled:
>>> cube = session.create_cube(table, feeding="disabled")
>>> cube.feeding
'disabled'
The cube has some hierarchies and measures:
>>> h, m = cube.hierarchies, cube.measures
>>> list(h)
[('Sales', 'Product')]
>>> list(m)
['Quantity.MEAN', 'Quantity.SUM', 'contributors.COUNT', 'update.TIMESTAMP']
and they can be changed:
>>> h["Product"].description = "Lorem ipsum"
>>> h["Product"].description
'Lorem ipsum'
>>> m["Quantity.MAX"] = tt.agg.max(table["Quantity"])
but there is no data in the cube:
>>> cube.query(m["Quantity.MAX"])
Empty DataFrame
Columns: []
Index: []
Enabling feeding blocks until the cube is entirely fed:
>>> cube.feeding = "enabled"
>>> cube.feeding
'enabled'
>>> cube.query(m["Quantity.MAX"])
  Quantity.MAX
0        1,000
Once enabled, feeding cannot be disabled:
>>> cube.feeding = "disabled"  
Traceback (most recent call last):
    ...
atoti._graphql.client.exceptions.GraphQLClientGraphQLMultiError: [400] The feeding of cube Sales cannot be disabled: feeding can only be changed from DISABLED to ENABLED...