Rebuilding Dimensions
When a dimension definition table changes, the dimension must be rebuilt for those changes to be reflected in Casabase Cube.
Changes that may require a rebuild include:
- Adding or removing members
- Changing parent-child relationships
- Changing aggregation operators
- Updating aliases or member properties
- Adding or modifying formulas
- Changing shared-member relationships
- Updating Time Balance properties
- Changing other mapped dimension metadata
During a rebuild, Casabase Cube reads the current dimension definition and regenerates the multidimensional structures required by the cube.
Rebuild Dimensions Manually
Section titled “Rebuild Dimensions Manually”Dimensions can be rebuilt through the Casabase Cube interface or programmatically through SQL.
Using the UI
Section titled “Using the UI”From Cube Config:
- Select the cube.
- Select Rebuild Dimensions.
- Choose whether to rebuild all dimensions or only dimensions configured for Auto Rebuild.
- Select Rebuild.
Casabase Cube rebuilds the applicable dimensions using their current dimension definition tables and configuration.
Using SQL
Section titled “Using SQL”Use:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'MY_CUBE', TRUE, FALSE, TRUE);The procedure accepts the following parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
P_CUBE_NAME |
VARCHAR | NULL |
Cube containing the dimensions to rebuild. If NULL, applicable dimensions across all cubes are rebuilt. |
P_REBUILD_ALL |
BOOLEAN | FALSE |
When TRUE, rebuilds all dimensions for the cube regardless of the Auto Rebuild setting. When FALSE, rebuilds dimensions configured for Auto Rebuild or currently inactive. |
P_SKIP_SNAPSHOTS |
BOOLEAN | FALSE |
When TRUE, skips creation of pre-rebuild snapshots. When FALSE, a snapshot is created before each applicable dimension is rebuilt. |
P_ASYNC |
BOOLEAN | TRUE |
When TRUE, applicable dimensions can be rebuilt asynchronously. When FALSE, dimensions are processed sequentially. |
REBUILD_DIMENSIONS requires the CUBE_ADMIN application role.
What a Rebuild Does
Section titled “What a Rebuild Does”For each applicable dimension, Casabase Cube processes the current dimension definition and updates the structures used by the multidimensional engine.
Conceptually:
Dimension Definition Table │ ▼ REBUILD_DIMENSIONS │ ▼ Validate Definition │ ▼ Rebuild Dimension │ ├── Members ├── Hierarchy Structures ├── Member Properties └── Formulas │ ▼ Updated Cube DimensionA rebuild ensures that changes in the dimension definition are reflected in the cube.
If the dimension definition includes a mapped formula column, formula changes are incorporated as part of the rebuild.
Rebuilding All Dimensions
Section titled “Rebuilding All Dimensions”Set:
P_REBUILD_ALL = TRUEto rebuild all dimensions in the selected cube regardless of their Auto Rebuild setting.
For example:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'FINANCE', TRUE, FALSE, TRUE);This is useful when you want to ensure that every dimension in the cube is rebuilt from its current definition.
Rebuilding Auto-Rebuild Dimensions
Section titled “Rebuilding Auto-Rebuild Dimensions”Set:
P_REBUILD_ALL = FALSEto process dimensions configured for Auto Rebuild, along with any applicable inactive dimensions.
For example:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'FINANCE', FALSE, FALSE, TRUE);The Auto Rebuild setting is configured independently for each dimension.
This allows frequently changing dimensions to participate in automated rebuild workflows while dimensions with relatively static definitions can be excluded.
Snapshots
Section titled “Snapshots”By default, Casabase Cube creates a snapshot before rebuilding an applicable dimension.
Snapshots provide a point-in-time copy of the dimension structures before the rebuild.
Set:
P_SKIP_SNAPSHOTS = TRUEto skip snapshot creation.
For example:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'FINANCE', TRUE, TRUE, TRUE);Skipping snapshots can be useful during development or testing when rollback capability is not required.
For production environments, retaining pre-rebuild snapshots provides a recovery point if a dimension definition change produces an unexpected result.
Asynchronous Rebuilds
Section titled “Asynchronous Rebuilds”By default:
P_ASYNC = TRUEallows applicable dimensions to be processed asynchronously.
This can improve rebuild performance when a cube contains multiple dimensions that need to be processed.
Set:
P_ASYNC = FALSEto process dimensions sequentially.
For example:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'FINANCE', TRUE, FALSE, FALSE);Sequential processing can be useful when you want dimensions to be rebuilt one at a time.
Automatic Rebuild
Section titled “Automatic Rebuild”The Auto Rebuild setting is configured at the dimension level.
When automated dimension-rebuild processing is enabled for the environment, dimensions marked for Auto Rebuild can participate in scheduled rebuild operations.
Scheduled dimension rebuilds use Snowflake managed-task capability and therefore depend on the EXECUTE MANAGED TASK privilege granted to the Native App.
Operational configuration, task monitoring, and recovery procedures belong to the Administration workflow rather than the dimension model itself.
See Operational Tasks for the current operational guidance.
Rebuilds and Hierarchies
Section titled “Rebuilds and Hierarchies”A dimension rebuild includes regeneration of the hierarchy structures associated with that dimension.
For example:
Dimension: ENTITY
Dimension Definition Table │ ▼ REBUILD_DIMENSIONS │ ▼ ENTITY │ ▼ Hierarchy Structures │ ┌────┴─────┐ ▼ ▼ Americas EMEAThis distinction is important:
- A dimension is the cube component being rebuilt.
- A hierarchy is a structure within that dimension.
REBUILD_DIMENSIONSrebuilds the dimension and regenerates the applicable hierarchy structures.
Rebuilds and Formulas
Section titled “Rebuilds and Formulas”If a dimension has a formula column configured, formulas defined in the dimension definition table are incorporated during the rebuild.
For example:
ACCOUNT Definition Table │ ├── Members ├── Relationships ├── Properties └── Formulas │ ▼ REBUILD_DIMENSIONS │ ▼ Updated ACCOUNT DimensionThis allows changes to calculated-member definitions to be applied along with other dimension changes.
See Formula Capabilities for information about formula processing.
After a Rebuild
Section titled “After a Rebuild”Dimension validation occurs as part of rebuild processing. After a successful rebuild, use a health check and a known verification query to validate the resulting cube before promoting significant metadata changes to production users.
A typical workflow is:
Modify DimensionDefinition Table │ ▼VALIDATE_DIMENSION (optional pre-check) │ ▼REBUILD_DIMENSIONS │ ▼ HEALTH_CHECK │ ▼Verification QuerySee:
- Dimension Validation for source-definition validation.
- Health and Diagnostics for cube-wide health checks.
Example Workflow
Section titled “Example Workflow”Assume the ENTITY dimension is sourced from:
CASABASE_CUBE.SHARED_DATA.FINANCE_ENTITYA new entity is added to the source definition:
PARENT CHILD-------------- ----------------North America United StatesNorth America CanadaNorth America MexicoAfter the source table is updated, rebuild the dimension:
CALL CASABASE_CUBE.CUBE.REBUILD_DIMENSIONS( 'FINANCE', TRUE, FALSE, TRUE);Casabase Cube reads the updated dimension definition and regenerates the applicable structures so the new member can participate in multidimensional queries.
Key Takeaways
Section titled “Key Takeaways”- Dimensions should be rebuilt when their source dimension definitions change.
- A rebuild updates the dimension and regenerates its applicable hierarchy structures.
- Rebuilds can incorporate changes to members, relationships, properties, formulas, and other mapped dimension metadata.
P_REBUILD_ALLcontrols whether all dimensions or only Auto Rebuild and applicable inactive dimensions are processed.- Pre-rebuild snapshots provide a recovery point and can optionally be skipped.
- Dimensions can be processed asynchronously or sequentially.
- Auto Rebuild is configured at the dimension level.
- A Snowflake managed task can automate rebuild processing for dimensions configured for Auto Rebuild.
- Hierarchy validation and health checks can be used after rebuilds to verify the updated cube.
Next Steps
Section titled “Next Steps”Continue with:
- Adding Dimensions for adding dimensions to a cube.
- Dimension Definition Tables for the source structure used to define dimensions.
- Dimension Validation for validating source definitions.
- Health and Diagnostics for evaluating the overall state of a cube.
