
I am trying to implement the scd1 in Data Build Tools using the Merge query. But I am not getting the exact way to write this query in Incremental model.
Can anyone show where we have to write the merge query.
{{ config( materialized='incremental' ) }} <MERGE QUERY HERE> {% if is_incremental() %} where last_modified_date > '2020-07-11' {% endif %}
1 Answer
You don't actually need to write the merge statement, dbt will take care of that for you. You should write a query that will return the records you want to upsert. You can then check the log for the merge query dbt generates.
Also check out the dbt docs on configuring incremental models: https://docs.getdbt.com/docs/building-a-dbt-project/building-models/configuring-incremental-models#what-is-an-incremental_strategy
2ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobWtxY2aDcYGOoaawZZSkerixjK6qnmWknbJuucSrnp5lo6mutbHMnqWtZZmjwKqwxGagp5uimrqmutOao2aln5myrXnFqKlmq5OZenJ5yKanpZ2dmru1rdM%3D