Change detection logic
How Prequel finds new and changed rows.
High watermark
Where each transfer starts and how that point moves.
Lookback window
How Prequel handles eventually consistent sources.
Duplication behavior
When and why duplicates can occur.
Rows transferred and delta rows
How row counts are calculated.
FAQ
Answers to common questions about change detection.
Change detection logic
Prequel relies on alast_modified_at type column to detect changes between transfers. On a model’s first transfer to a destination (or on a full refresh), the model’s history is transferred, and the greatest last_modified_at value is recorded as the high watermark. Each later transfer reads only rows at or after the high watermark, minus the lookback window. This allows Prequel to predictably transfer batches of updated data.
Incremental transfer query
Timestamp precision
When the greatestlast_modified_at value is recorded, it is stored as an epoch, or “unix timestamp”. This value has second precision.
For example, if a batch of data is transferred where the greatest last_modified_at timestamp value was 2025-01-01 1:15:30 AM, the equivalent epoch integer will be stored: 1735694130.
High watermark
Prequel stores one high watermark per model per destination: the greatestlast_modified_at value transferred for that model. Each incremental transfer reads from the high watermark minus the lookback window, so every model resumes where it left off, independently of the other models on the destination.
Prequel moves the high watermark conservatively, so that a failure or an empty result never causes data to be skipped:
- It advances only when the model transfers successfully. A model that fails during an incremental transfer resumes from its previous high watermark on the next transfer, so the failure does not leave a gap. In a transfer with a
PARTIAL_FAILUREstatus, the models that succeeded still advance. - Windowed transfers advance it after each window that transfers rows. If a windowed transfer fails partway, the progress from completed windows is kept, and the next transfer picks up from there.
- An incremental transfer that finds no new rows leaves it unchanged.
- A full refresh that finds no rows does not set it. Finding no data in the source is not proof that no data exists up to the present, so Prequel does not record a high watermark from an empty result. The model’s next transfer runs as a full refresh again, so a source that is still being populated is never mistaken for an empty one.
- An incremental transfer never moves it backward. A transfer whose
end_transfer_window_atis earlier than the high watermark leaves it unchanged, and one that ends later advances it to the greatest value transferred. - A full refresh resets it to the greatest value transferred by the full refresh.
Full refresh lower bound
Every full refresh, including a model’s first transfer to a destination, picks its lower bound by checking these settings in order and using the first match:- If the transfer request sets
start_transfer_window_aton Create transfer, the full refresh reads from that time. - Otherwise, if the recipient sets
default_full_refresh_min_start_time_epochwith Update recipient, the full refresh reads from that time. - Otherwise, if the model uses windowed transfers, the full refresh reads from the model’s
min_start_time_epoch. - Otherwise, there is no lower bound. The full refresh reads from the Unix epoch (
0), which includes all history in the source.
Lookback window
Some sources are eventually consistent, so a row can become visible after rows with a laterlast_modified_at have already been transferred. This is most common when last_modified_at is set by an external system and does not increase monotonically. To catch these rows, Prequel starts each incremental transfer one lookback window before the high watermark. The lookback window depends on the source vendor:
Lookback window query
- Transfers with an explicit start. When a transfer request sets
start_transfer_window_at, Prequel reads from one lookback window before that start. The upper bound is not extended. - Windowed transfers. Each window of a windowed transfer applies its own lookback, so a 1-minute window on a source with a 5-minute lookback reads about 6 minutes of data.
{{.LastModifiedAtEpoch}} in a source query. See Skipping the lookback window.
Late-arriving rows
Each incremental transfer only reads rows whoselast_modified_at falls within the lookback window or later. A row that is written to your source with an older last_modified_at is skipped and never reaches the destination.
For example, on a source with a 5-minute lookback window:
- Transfer A ends with a high watermark of
12:00:00. - A row is then written to the source with a
last_modified_atof11:50:00. - Transfer B reads rows with a
last_modified_atof11:55:00or later, so it skips the row. - No later incremental transfer reads it either, so the row never reaches the destination.
last_modified_at records when an event occurred rather than when the row was written. Use arrival time as the last_modified_at column to avoid it. See the tip in Change detection logic.
To recover rows that were skipped, run a transfer with start_transfer_window_at set before their last_modified_at, or run a full refresh.
Duplication behavior in Prequel
How Prequel handles duplicate data depends on your destination type:Database and data warehouse destinations
No duplicates in your tables. Prequel uses upsert operations to ensure that lookback windows do not create duplicate rows in database destinations like Snowflake, BigQuery, PostgreSQL, etc.Object storage destinations
Duplicates may occur. Object storage destinations (S3, GCS, Azure Blob Storage) are append-only by design, unless using Delta Lake. Lookback windows may cause the same data to be written multiple times and it is the expectation that these are deduplicated by the downstream data pipeline after data is written to the destination.Primary key requirements
For all destinations, your source data must have unique primary key values within each transfer batch. Duplicate primary keys in your source data will cause transfer errors.Interaction with a custom source_query
If you choose to use a source_query instead of the default table query, you may wonder how your source query interacts with the change detection queries.
In cases where a source_query is used, Prequel applies the same predicate filtering outside of the custom source_query.
Filtering over a source query
Change detection over a
source_queryIf your source_query preemptively filters data using a last_modified_at column, you may avoid the safety of the lookback window. In some cases, this may be intentional, but this tradeoff should be considered as you think about your upstream data pipeline.Rows transferred and delta rows
In the Prequel UI (Transfer details) and API responses, you’ll often see two row counts:- Rows (
rows_transferred): How many rows were selected from the source for this model in that transfer. - Delta rows (
delta_rows_transferred): An estimate of how many rows in that transfer have alast_modified_atvalue newer than the most recent previously completed transfer for that model (the current high watermark).
rows_transferred: how it’s calculated
rows_transferred is an extraction metric: it counts the rows returned by Prequel’s source query.
- The lower bound is inclusive.
- The upper bound is exclusive when an end window is specified.
- A lookback window is applied by querying slightly earlier than the lower bound; rows from this overlap are included in
rows_transferred.
Rows transferred count
delta_rows_transferred: how it’s calculated
delta_rows_transferred is a calculated estimate derived from the extracted rows. It counts rows whose last_modified_at is strictly newer than the current high watermark.
- Included: rows where
last_modified_at > high watermark(and within the transfer’s upper bound, if one is specified). - Excluded: the lookback overlap (to avoid counting that overlap in delta rows).
Delta rows count
- Why it can be
0for historical transfers: If you run a transfer over an older time range,delta_rows_transferredcan be0even whenrows_transferredis large if none of the rows in that window have alast_modified_atvalue newer than the most recent completed transfer’s high watermark.
FAQ
Is the high watermark tracked per model?
Is the high watermark tracked per model?
Yes. Prequel stores a separate high watermark for each model on each destination, so models advance independently. A new model added to a destination runs a full refresh while the other models continue from their own high watermarks.
What happens to the high watermark when a transfer fails?
What happens to the high watermark when a transfer fails?
A model that fails during an incremental transfer keeps its previous high watermark, and the next transfer reads from that point again, so Prequel recovers from failed incremental transfers without leaving gaps or needing a full refresh. In a windowed transfer, windows that completed before the failure are kept.
Why didn't a transfer pick up rows that are in my source?
Why didn't a transfer pick up rows that are in my source?
The rows most likely have a
last_modified_at earlier than the high watermark minus the lookback window, which happens when rows are written to the source after newer rows have already been transferred. See Late-arriving rows to prevent this and to recover the rows.How do I resend older rows without moving the high watermark?
How do I resend older rows without moving the high watermark?
Run a transfer with
start_transfer_window_at and end_transfer_window_at set to a range that ends before the high watermark. The transfer reads that range, and the high watermark stays where it is.Why is delta_rows_transferred 0 when rows_transferred is not?
Why is delta_rows_transferred 0 when rows_transferred is not?
delta_rows_transferred counts only rows newer than the high watermark. A transfer over an older time range can read many rows without any of them being newer than the high watermark. See Rows transferred and delta rows.Why do the same rows appear again in object storage when no new data arrived?
Why do the same rows appear again in object storage when no new data arrived?
Each incremental transfer re-reads rows within the lookback window before the high watermark. Warehouse and database destinations upsert these rows by primary key, but object storage destinations write them as new files. Deduplicate them downstream by primary key, keeping the row with the latest
last_modified_at.Can I change the lookback window?
Can I change the lookback window?
No. The lookback window is fixed per source vendor and cannot be configured per source or model. To skip it, filter on
{{.LastModifiedAtEpoch}} in a source query. See Skipping the lookback window.Can I change a model's last_modified_at column?
Can I change a model's last_modified_at column?
No. A model’s
last_modified_at column cannot be changed after the model is created. To track changes with a different column, create a new model that uses it.