saurabh18cs
Honored Contributor III

Hi @yit Lakeflow supports upsert/merge semantics natively for Delta tables unlile ForEachBatch

Instead of writing custom forEachBatch code, you declare the merge keys and update logic in your pipeline configuration.Lakeflow will automatically generate the necessary MERGE statements and handle upserts for you.

 

e.g.

sinks:
my_delta_sink:
type: delta
path: /mnt/delta/my_table
merge:
keys: ["id"] # columns to match for upsert
whenMatched: update
whenNotMatched: insert