I was working with streaming in delta tables with foreachbatch.
spark.readStream.format("delta") \
.option("readChangeFeed", "true").option("startingVersion","latest") \
.load("dbfs:/mnt/cg/file_to_up/table2") \
.writeStream.queryName("myquery") \
.foreachBatch(merge_deltas) \
.option("checkpointLocation", "dbfs:/mnt/cg/tmp/checkpoint") \
.trigger(processingTime='2 seconds') \
.start()
I would like to know if there is a way to do the merge between a delta table(source) and synapse table(target) I found this page here in "Write to Azure Synapse Analytics using foreachBatch() in Python" is the closest I have found to what I need, I think that use the modes(append, overwrite) of the write will not help me.
Also, I know that it could be simulated using insert and delete in post and pre action option, but if there is way to do it with the merge that would be great.