Without a unique_key, dbt typically cannot safely upsert. Many adapters fall back to an append-only behavior: each incremental run inserts the filtered batch as new rows.
Consequences
Run 1: load orders for day D Run 2: filter wrong / overlap → insert same order_ids again Result: duplicate grain rows in the table
When no unique_key is OK
- Truly append-only event streams
- Your
is_incremental()filter guarantees disjoint batches (e.g. strict watermark with no late data) - You accept duplicates and dedupe in a downstream model
When you need unique_key
- Source rows can be updated (
updated_atchanges) - Late data can reappear for an old key
- Consumers expect one row per business key
{{ config(
materialized='incremental',
unique_key='order_id',
incremental_strategy='merge'
) }}Interview tip: "No unique_key means I am betting on append-only semantics. If updates or late arrivals exist, I need a key and a merge/delete strategy."