Skip to content

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.

Dimensions can be rebuilt through the Casabase Cube interface or programmatically through SQL.

From Cube Config:

  1. Select the cube.
  2. Select Rebuild Dimensions.
  3. Choose whether to rebuild all dimensions or only dimensions configured for Auto Rebuild.
  4. Select Rebuild.

Casabase Cube rebuilds the applicable dimensions using their current dimension definition tables and configuration.

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.

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 Dimension

A 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.

Set:

P_REBUILD_ALL = TRUE

to 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.

Set:

P_REBUILD_ALL = FALSE

to 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.

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 = TRUE

to 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.

By default:

P_ASYNC = TRUE

allows 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 = FALSE

to 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.

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.

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 EMEA

This distinction is important:

  • A dimension is the cube component being rebuilt.
  • A hierarchy is a structure within that dimension.
  • REBUILD_DIMENSIONS rebuilds the dimension and regenerates the applicable hierarchy structures.

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 Dimension

This allows changes to calculated-member definitions to be applied along with other dimension changes.

See Formula Capabilities for information about formula processing.

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 Dimension
Definition Table
VALIDATE_DIMENSION
(optional pre-check)
REBUILD_DIMENSIONS
HEALTH_CHECK
Verification Query

See:

Assume the ENTITY dimension is sourced from:

CASABASE_CUBE.SHARED_DATA.FINANCE_ENTITY

A new entity is added to the source definition:

PARENT CHILD
-------------- ----------------
North America United States
North America Canada
North America Mexico

After 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.

  • 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_ALL controls 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.

Continue with: