How to convert CSV file to XML using Azure synapse analytics or ADF.

Archana Metkari 0 Reputation points
2023-06-16T18:21:23.5433333+00:00

I have csv input file stored in the azure datalake , want to convert the csv file to .XML formatted file. How to achieve that using Azure Data factory / azure synapse dedicated/serverless sql pool

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,627 questions
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,366 Reputation points Moderator
    2023-06-20T22:36:11.41+00:00

    Hello @Archana Metkari,

    There is no direct out-of-the-box transformation in ADF, but I have done it using the Derived Column Expression, Please have a look at the below DataFlow, I hope it may be helpful with your initial query!

    In the Derived Column, i have mentioned something similar to capture the XML formatted tag value.

    '<salesheader SysRowID="' + toString(SysRowID) + '" LSN="' + LSN + '" LastProcessedChangeDateTime="' + toString(LastProcessedChangeDateTime) + '" DataLakeModifiedDateTime="' + toString(DataLakeModifiedDateTime) + '" RecID="' + RecID + '" LINEDISC="' + LINEDISC + '"/>'

    Please check the below Data Flow for more info.

    Source is as usual to read the CSV file.

    Use the Derived Column Transformation.

    Use the Sink as usual to map the Derived Column in the Sink.
    User's image

    User's image

    Sink: Mapping:

    User's image

    As you can see my output is in XML tag format which I will use for further processing!
    User's image

    User's image

    If the response is helpful, please click "Accept Answer" and upvote it. So that we can close this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.