DataBrewery / cubes

[NOT MAINTAINED] Light-weight Python OLAP framework for multi-dimensional data analysis
http://cubes.databrewery.org
Other
1.49k stars 314 forks source link

Make all model objects immutable #282

Open Stiivi opened 9 years ago

Stiivi commented 9 years ago

Potential mutability of model objects is sometimes causing unexpected behavior. All model objects should be immutable, including Cube. All setters should be removed.

The problem is Cube creation and linking. Currently the cube is created in two steps:

# In Provider
cube = Cube.from_metadata(metadata)
link_cube(cube, locale, provider, namespace)

Replace that with a dimension finder that will be passed into the Cube:

# Somewhere in workspace
finder = DimensionFinder(root_namespace)

# In Provider
cube = Cube.from_metadata(metadata, finder)

finder might act as a dictionary object with dictionary item getters.

Expect Cube.__init__ to receive final list of linked dimensions.

Stiivi commented 7 years ago

Other mutable methods:

Stiivi commented 7 years ago

This needs to be reviewed and updated.