I am trying to copy data from Azure SQL to Azure Cosmos Db Collection (Mongo API). I am using upsert to insert/update the documents on Cosmos Db. However, if any data from source is deleted, how do I delete that document from Cosmos Db.
1
votes
1 Answers
0
votes
As far as I am aware,it is impossible to deleting documents from Cosmos Db collection during incremental load.
Because,incremental load is comparing LastModifytime
.If you delete rows in azure sql,them don't exist in source and copy data only supports insert
and update
.
If you want to synchronized your data,please delete them in cosmos db manually.
You can run the delete sql in cosmos db or add a column DeleteStatus
.When you want to delete data,update DeleteStatus
and LastModifytime
then incremental load.Finally,run the sql both in cosmos db and azure sql:
delete from xxxx where DeleteStatus = 1
Hope these can help you.