Hi, at least in my case , this is because I’ve schema evolution enabled. If I don’t this is not a problem.
TLDR:
dbt will insert a dbt_unique_key column at their 2nd run of the model. You can notice this in the dbt.log file.
You will see how at the first run of an snapshot, dbt doesn’t use the dbt_unique_key column. But in the following snapshot runs it does. And due to the schema evolution enabled this causes the issue.
One workaround solution to support schema evolution in snapshot models is to set the following query in the post_hook section “ALTER TABLE {{ this }} DROP COLUMN IF EXISTS dbt_unique_key”