Delta table merge on multiple columns
03:30 31 Aug 2021

i have a table which has primary key as multiple columns so I need to perform the merge logic on multiple columns


DeltaTable.forPath(spark, "path")
  .as("data")
  .merge(
    finalDf1.as("updates"),
    "data.column1 = updates.column1 AND data.column2 = updates.column2 AND data.column3 = updates.column3 AND data.column4 = updates.column4 AND data.column5 = updates.column5")
  .whenMatched
  .updateAll()
  .whenNotMatched
  .insertAll()
  .execute()

When I check the data counts it is not updating as expected.

Could someone help me here on this?

databricks azure-databricks delta-lake