Rebuilding Aggregates Using the REST API
You can use the aggregate-batch
endpoint of the AtScale engine REST API to trigger an initial build or rebuild for all aggregates of a deployed model. You can also use it to trigger incremental aggregate builds for specific datasets within a model.
One use case for this feature is the need to rebuild aggregates after ETL (Extract, Transform, Load) jobs. Many companies have ETL jobs that they routinely run to cleanse raw data and load it into the data warehouse. You can use AtScale's REST API to programmatically rebuild aggregates for a model as a part of your ETL processing.
The following sections describe how to use the aggregate-batch
endpoint to run different types of aggregate builds.
Trigger an aggregate build via API
You can use aggregate-batch
to trigger a non-incremental build or rebuild for a specific model.
Prerequisites
Before triggering an aggregate build via API, ensure that:
- You have the
aggregates_manage
role assigned in the Identity Broker. For more information, see Identity Broker Default Roles. - The model you want to run builds for has been deployed.
API reference
Detail | Description |
---|---|
Endpoint | aggregate-batch/projectId/cubeId |
URL Parameters | projectId : The ID of the catalog that contains the model you want to run builds for. |
Query Parameters | cubeId : The ID of the model you want to run builds for. |
HTTP Method | POST |
Authentication | Each API call to the AtScale engine must include an API token in the HTTP request header. |
Return Responses | 201: Created / Success 400: Bad Request 401: Unauthorized 404: Not Found 500: Server Error 503: Server Unavailable |
For example:
curl --location 'http://<host>:<port>/aggregate-batch/projectId/<projectId>cubeId=<cubeID>&isFullBuild=false' \
--header 'Content-Type: application/json' \
Trigger an incremental aggregate build via API
You can also use the API to trigger incremental aggregate builds for specific datasets within a model. This enables you to run ad-hoc incremental builds without having to modify the datasets’ configured grace periods.
Prerequisites
Before triggering an incremental aggregate build via API, ensure that:
-
You have the
aggregates_manage
role assigned in the Identity Broker. For more information, see Identity Broker Default Roles. -
Grace period overrides are enabled at the global level, as well as on the model you want to run aggregate builds for:
- Set the
aggregate.batch.gracePeriodOverrides.enabled
global setting totrue
. This setting is disabled by default. You do not need to restart the engine after changing it. For more information, see Global Settings for Both System-Defined and User-Defined Aggregates. - Set the
aggregate.batch.cube.gracePeriodOverrides.enabled
setting totrue
on the models you want to run incremental builds for. This setting is disabled by default. For more information, see Aggregate Incremental Builds Settings.
- Set the
-
Incremental builds are enabled on the datasets you want to run aggregate builds on. For more information, see Setting Properties to Allow Incremental Rebuilds of Aggregates.
-
The models you want to run builds for have been deployed.
Enabling this functionality can potentially cause your system to become strained by expensive aggregate rebuilds.
API reference
Detail | Description |
---|---|
Endpoint | aggregate-batch/projectId/cubeId |
URL Parameters | projectId : The ID of the catalog that contains the model you want to run builds for. |
Query Parameters | cubeId : The ID of the model you want to run builds for. |
HTTP Method | POST |
Body | grace-period-overrides : A list of the datasets you want to provide grace period overrides for, as well as the numeric override values. You can include as many datasets as you want. |
Authentication | Each API call to the AtScale engine must include an API token in the HTTP request header. |
Return Responses | 201: Created / Success 400: Bad Request 401: Unauthorized 404: Not Found 500: Server Error 503: Server Unavailable |
For example:
curl --location 'http://<host>:<port>/aggregate-batch/projectId/<projectId>cubeId=<cubeID>&isFullBuild=false' \
--header 'Content-Type: application/json' \
--data '{"grace-period-overrides" :
{
"Internet Sales": 30,
"Reseller Sales": 90
}
}'