locked
What is the best way to Insert/Update 1000 entities in a Batch Transaction to Azure tables ? RRS feed

  • Question

  • I have an object List<IDs> with 1000 entities and have to insert/Update in the Azure table. Some entities already exist with the same PartitionKey and RowKey and would need to update in that case.

    I was wondering what is the best way to Insert/Update all the entities. Batch Transaction only allows 100 entities.

    Thanks,

    Harsimrat

    Tuesday, September 18, 2012 6:59 PM

Answers

  • Hi Harsimrat, great question!

    First, yes - Batch transaction is the best way to do this, but is limited to 100 entities, which means you will need to use ~10 batch transactions to do this upload.

    That said, you should check out "upsert" functionality, which can be thought of as "insert or replace" or "insert or merge", depending on which one you use.  This would eliminate the need to check for existence of the entity first before uploading the entities.

    You can read about upsert in our "How-To" (which shows an "insert or replace"), or in our blog post (which discusses upsert in depth).

    Hope that helps, let us know if you need anything else!


    -Jeff

    • Marked as answer by thukralz Wednesday, September 19, 2012 1:56 AM
    Wednesday, September 19, 2012 12:12 AM