In this article, I will show you the process of setting up an upsert operation in Cosmos DB using Azure Data Factory. With an upsert operation we can either insert or update an existing record at the same time. To compare to the existing records, upsert statement use key column(s) to determine if this is a new or existing record. We will use Azure SQL database as a source and CosmosDB as a sink.
Let’s create a sample table in SQL Server. It will be used as a source in ADF:
CREATE TABLE TBL_SQL_TO_COSMOS_INCR (SALES_ORDER_ID INT , SALES_AMOUNT