How it works
The incremental pattern uses two dynamic datasets:
After each delta deployment, you merge or append the delta rows into the base table
using a
MERGE or INSERT INTO statement.
Setup
1. Create the base aggregate
Create a dynamic dataset with the dimension keys and metrics you want to cache. Enable it as a pre-aggregate cache:- Snowflake
- Databricks
2. Create the delta aggregate
Duplicate the base aggregate and add a date filter for the incremental window (e.g. last day or last 7 days). The delta is a staging table - do not setuse_for_cache on it.
- Snowflake
- Databricks
preagg_orders) - full history:
Delta (
preagg_orders_delta) - yesterday only (date.date >= CURRENT_DATE - 1):
Base aggregate (
preagg_orders) - after incremental run:
3. Initial deployment
Deploy the base aggregate once to populate the full historical table, using the Honeydew UI or deployment API.Incremental update strategies
Both phases run entirely inside your orchestrator (Airflow, dbt, or similar):- Deploy the delta - your orchestrator calls the Honeydew API to compute and write the delta dataset to a staging table. See Set up with ETL tools.
- Merge or append - your orchestrator then runs the SQL below to move the delta rows into the base aggregate table.
Append - new records only
Use this when source records are immutable after they are written (e.g. event logs where past dates never change). 1. Call the Honeydew API to compute and write the delta dataset for yesterday. 2. Your orchestration tool runs:Merge - backfill and append
Use this when source records can change after the fact (e.g. orders that are updated for up to 7 days). Widen the delta filter to cover the backfill window, then useMERGE to update existing rows and insert new ones.
1. Update the filter in preagg_orders_delta to date.date >= CURRENT_DATE - 7.
2. Call the Honeydew API to compute and write the delta dataset.
3. Your orchestration tool executes:
- Snowflake
- Databricks
Honeydew column names follow the format
entity.attribute. Use double quotes in
Snowflake ("date.date") and backticks in Databricks (`date.date`). List all
columns explicitly in MERGE statements - wildcards are not supported.Related
- Aggregate Aware Caching - how pre-aggregate caches work and how Honeydew matches them to user queries