Append to an existing xml file in ADLS

BalwinderKaur-5937 41 Reputation points
2021-10-04T05:04:57.663+00:00

I have created a pipeline in synapse that has two web activities the first one fetches the data from a REST API and other one stores that data in ADLS. is there any activity or option that I can use to append the data in the storage account instead of overwriting the existing data. ![137239-image.png][1] ![137284-image.png][2] [1]: /api/attachments/137239-image.png?platform=QnA [2]: /api/attachments/137284-image.png?platform=QnA

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,349 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,396 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,603 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. svijay-MSFT 5,201 Reputation points Microsoft Employee
    2021-10-05T12:58:33.907+00:00

    Hello anonymous user,

    Thanks for the question and using MS Q&A platform.

    From your question I'm understanding that you would like to append the XML Data to a single file rather than overwriting.

    You could make use of Append Blobs in place of Block Blobs.

    137726-image.png
    Referring this link

    Step 1 :

    To create AppendBlob - You will have to invoke a PUT request with the header x-ms-blob-type = AppendBlob with content length = 0 . This is a one time process.

    Note : You could either create it manually or dynamically check whether the blob exist, if not create a AppendBlob with 0 content length.

    **Step 2: **

    Once the blob has been created you can append the data- by making use of the below endpoint. (Reference)

    https://storagename.blob.core.windows.net/container/directory/filename.xml?comp=appendblock

    Again, you will have to pass the header x-ms-blob-type = AppendBlob in addition to other headers(like x-ms-version etc) .

    Output :

    At my end, I tried appending the same XML data twice.

    137785-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators