# Config merge\_exclude\_columns acts only on merge not on insert

**URL:** <https://discourse.getdbt.com/t/config-merge-exclude-columns-acts-only-on-merge-not-on-insert/10199>\
**Category:** Help\
**Tags:** incremental, snowflake\
**Created:** [October 3, 2023, 3:13pm UTC](https://discourse.getdbt.com/t/config-merge-exclude-columns-acts-only-on-merge-not-on-insert/10199 "2023-10-03T15:13:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dr\_Chris](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/dr_chris/32/2130_2.png) [@Dr\_Chris](https://discourse.getdbt.com/u/Dr_Chris)\
**Post date:** [October 3, 2023, 3:13pm UTC](https://discourse.getdbt.com/t/config-merge-exclude-columns-acts-only-on-merge-not-on-insert/10199/1 "2023-10-03T15:13:45Z")

</div>

I have an incremental model and I want to exclude a few columns (autoincrement columns in Snowflake as well columns with default value as CREATED\_ON col) For this I use merge\_exclude\_columns (as described in the doc ([Incremental models | dbt Developer Hub](https://docs.getdbt.com/docs/build/incremental-models)).

So my config is:  
{{ config(materialized=‘incremental’,  
alias= var(‘tgt\_tbl’) ,  
unique\_key= var(‘ukey\_nm’),  
incremental\_strategy= var(‘incrtype’),  
merge\_exclude\_columns = [‘TIME\_CREATED\_ON\_DATE’,‘STORE\_CODE\_AUTOKEY’,‘PRODUCT\_AUTOKEY’],  
schema=var(‘tgt\_schm\_nm’),  
transient=false,  
pre\_hook= [use\_warehouse(var(‘vwh’))],  
)  
}}

The dbt command with the variables looks like:  
dbt run -s cdf\_rpos\_mod\_incremental --vars ‘{vwh: MY\_WH, tgt\_schm\_nm: MY\_SCH,tgt\_tbl\_nm: TARGET\_TAB,load\_id: 22,ukey\_nm: PRIMARYKEY\_HASH,incr\_col\_nm: ,incrtype: merge}’

The problem I’m having that the unwanted columns are not present in the merge branch but the insert branch still has the columns that should be excluded:  
`merge into MY_DB.MY_SCH.TARGET_TAB as DBT_INTERNAL_DEST using MY_DB.MY_SCH.TARGET_TAB__dbt_tmp as DBT_INTERNAL_SOURCE on DBT_INTERNAL_SOURCE."PRIMARYKEY_HASH" = DBT_INTERNAL_DEST."PRIMARYKEY_HASH" when matched then update set "STORE_JSON" = DBT_INTERNAL_SOURCE."STORE_JSON", … ,"PRIMARYKEY_HASH" = DBT_INTERNAL_SOURCE."PRIMARYKEY_HASH" when not matched then insert ("STORE_JSON", …, "PRIMARYKEY_HASH", "TIME_CREATED_ON_DATE", "STORE_CODE_AUTOKEY") values ("STORE_JSON", …, "PRIMARYKEY_HASH", "TIME_CREATED_ON_DATE", "STORE_CODE_AUTOKEY")`

Anyway to exclude the columns completely from the statement?
