none
Enable upsert in CosmosDB

    Question

  • Hi there,

    I read a few things about UpsertDocumentAsync to upsert in CosmosDB doc.

    Is is possible to enable Upsert for a collection in CosmosDB. Means whenever I try to insert and if the id already exists then replace the doc with new doc.

    If this is not possible then please help me how can I achieve the following thing.

    I want to create copy task which reads parquet file from ADLS and writes it to CosmosDB. How can I achieve upsert here?Currently it gives me error - "Resource with specified id or name already exists" when I rerun the pipeline, obviously because most of the data already exists

    Since I am trying to import dimensions, I want to reload them periodically

    Thanks

    Tuesday, July 10, 2018 12:57 AM

All replies

  • Atomic upsert is now supported by Azure DocumentDB.Yes, a store procedure would work great for upsert. You can look at code samples available on DocumentDB's Github:


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. profile for Sajeetharan at Stack Overflow, Q&A for professional and enthusiast programmers

    Tuesday, July 10, 2018 1:45 AM