dbt incremental model ap kreye duplicate records
posée 2 months ago63 vuesen
0
Mwen gen yon dbt incremental model ki ap chaje done chak jou nan Snowflake. Men apre plizyè jou, mwen remake menm records yo parèt plizyè fwa nan destination table la.
What I tried
Mwen mete unique_key='transaction_id', men duplicate yo toujou ap parèt.
{{ config(
materialized='incremental',
unique_key='transaction_id'
) }}
SELECT
transaction_id,
customer_id,
amount,
transaction_date
FROM {{ source('sales', 'transactions') }}
{% if is_incremental() %}
WHERE transaction_date >= (
SELECT MAX(transaction_date)
FROM {{ this }}
)
{% endif %}
Error message
transaction_id | count
---------------|------
10001 | 3
10002 | 2
10003 | 4
Expected result
Chak transaction_id ta dwe parèt sèlman yon sèl fwa nan final table la.
Environnement :dbt,snowflake dbt 1.10SnowflakeWindows 11
Diagnostic IA
Généré par IA. Ce n'est pas une réponse — la communauté ci-dessous le confirme ou le corrige. Vérifiez toujours avant de vous y fier.
posée 2 months ago
Vel Jules 77
Aucune réponse
Sign in and verify your email to post an answer.