cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Merge not adding new columns to delta table

Benedetta
New Contributor III
SQL Merge not adding new columns to delta table error is: cannot resolve Target AuditUpdateDate in UPDATE clause given columns in Source
this config is set: spark.conf.set("spark.databricks.delta.schema.autoMerge.enabled",True)
We're using DBR 12.2 LTS (includes Apache Spark 3.3.2, Scala 2.12)
Per the documentation below seems like new columns should be added.
What am I doing wrong? Thanks!
Benedetta
Benedetta_0-1689344912359.png
SQL query below trying to add new column: AuditUpdateDate
MERGE INTO XYZ.table1 AS Target USING cleansedTV AS Source
ON Target.col1 = Source.col1 AND Target.col2 = Source.col2
WHEN MATCHED AND( Target.col3 <> Source.col3
AND Target.col4 <> Source.col4
AND Target.col5 <> Source.col5
)
THEN UPDATE SET
Target.col3 = Source.col3
, Target.col4 = Source.col4
, Target.col5 = Source.col5
,Target.AuditUpdateDate = Source.AuditUpdateDate ----> Trying to add new column here
WHEN NOT MATCHED THEN INSERT *
0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group