How to Write JSON Data From Parameter or Variable to Azure Blob Storage File in Azure Data Factory

 Issue: How to Write JSON Data From Parameter or Variable to Azure Blob Storage File in Azure Data Factory.


In this article, we are going to learn how to write JSON data from a parameter or variable to an Azure blob storage file on Azure Data Factory,  in this scenario I have JSON data which I will save in the parameter, then set into the variable and then will write into the file, let's start our demonstration.

Open your Azure Data studio, go to the Author tab, click on the pipeline, then click on the new pipeline, go to the parameter tab, click on the + New button to create a new parameter, then name your parameter, select the type, and paste the JSON data.


Next, go to the variable tab, click on the + New button, name your variable and select the type.


Next, find and bring the Set variable activity, go to the Variables tab, select the variable which we have created earlier, then in the value, click on the ''Add dynamic value'' and select the parameter which we have created earlier.



Once we are done with our Set variable activity, find and bring the copy data activity, connect with the set variable activity, then go to the Source tab, click on the + New button to create a new source dataset.


Select Azure blob storage then click on continue.


Select CSV as file format, then click on continue.


Name your source dataset, select the linked service which points to blob storage, then select the file path, select the template file, then click on Ok.


In the source tab, click on the + New button to create an additional column, name your column then in the value click on the '' Add dynamic content and select my variable.


Once we are done with our source tab, go to the sin tab, click on the + New button to create a new sink dataset.


 Select Azure blob storage then click on continue.


Select the CSV file, then click on continue.


Name your sink dataset, select the linked service, select the folder path where we will write our file, then click on ok.


In the sink tab, click on the Open button to provide the output file name.


Provide the output file name, select No escape character, select No quote character, then back to the pipeline.




Go to the mappings tab, click on import schemas, provide the value to the variable and click on ok.


In the mappings tab, delete the template file column and leave the additional column as it is.


Next, go to the Variables tab, click on the values and add the curly brackets, click on ok and debug the pipeline.






Video Demo: How to Write JSON Data From Parameter or Variable to Azure Blob Storage File in Azure Data Factory




 









  

No comments:

Post a Comment