Incremental Strategy "Merge" is generating Delete, Insert into command
See original GitHub issueMerge strategy in incremental, generates delete and insert into command instead of the merge.
{{ config( as_columnstore= false, materialized= 'incremental', incremental_strategy= 'Merge', unique_key='customer_code' ) }} SELECT customer_code, customer_name FROM {{ref('customer')}}
The run script:
delete from "......."."dim_customer" where (customer_code) in ( select (customer_code) from "......."."#dim_customer__dbt_tmp" ); insert into "......."."dim_customer" ("customer_code", "customer_name") ( select "customer_code", "customer_name" from "......."."#dim_customer__dbt_tmp" );
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
Understanding dbt Incremental Strategies part 1/2 - Medium
The delete+insert strategy is very similar to merge, but instead of updating existing records and insert new records, it deletes existing records and...
Read more >Incremental models - dbt Developer Hub
On warehouses that do not support merge statements, a merge is implemented by first using a delete statement to delete records in the...
Read more >Implement a delete+insert incremental_strategy for Google ...
As an alternative, we have to define a unique_key based on multiple columns. This wouldn't work for cases where the source for the...
Read more >How do we use the merge statement inside Incremental model ...
You don't actually need to write the merge statement, dbt will take care of that for you. You should write a query that...
Read more >Incremental load of the data warehouse using Merge vs ...
1) MERGE command. Update when there is a Match; Insert when Not Match · 2) DELETE+INSERT. Delete rows from the Target table where...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @dataders,
here are the details:
_(base) reza@dbt:~/Desktop$ dbt --version installed version: 1.0.7 latest version: 1.1.0 Your version of dbt is out of date! You can find instructions for upgrading here: https://docs.getdbt.com/docs/installation Plugins:
and I am using Azure SQL Database. Cheers, Reza
I checked the dbt-core sources and the “get_merge_sql” macro isn’t called on project. Some official adapters reimplement the incremental materialization and use that macro. I don’t know if the effort to support this is gonna pay, as by this comment, they’re planning to refactor all the materialization code: https://github.com/dbt-labs/dbt-core/issues/5260#issuecomment-1132871807