snowflake
dbt Incremental Events Model
A compiled dbt incremental model that appends new events. Lineage shows the source events table feeding the incremental sink with a watermark filter.
The lineage
The SQL
CREATE OR REPLACE TABLE raw.events (
event_id STRING,
user_id NUMBER,
event_name STRING,
occurred_at TIMESTAMP,
amount NUMBER(12,2)
);
CREATE OR REPLACE TABLE analytics.fact_events_incr (
event_id STRING,
user_id NUMBER,
event_name STRING,
occurred_at TIMESTAMP,
amount NUMBER(12,2)
);
INSERT INTO analytics.fact_events_incr
SELECT
event_id,
user_id,
event_name,
occurred_at,
amount
FROM raw.events
WHERE occurred_at > (SELECT COALESCE(MAX(occurred_at), '1900-01-01') FROM analytics.fact_events_incr);
What the lineage shows
- Each fact_events_incr column is sourced from the matching raw.events column.
- The watermark subquery references the target itself — visible as a self-edge in lineage.
- Useful pattern for verifying that incremental filters do not drop columns.