Azure DataFactory create folder dynamically and create json file

Viewed 130

I have a scenario in which, through datafactory a folder must be created dynamically, which implies that its name must be generated dynamically, this folder is created inside a root folder, once this folder is created, then create a couple of Json files in it, but I can't figure out how to do it.

enter image description here

The idea is to generate the json files from sql server and through datafactory consult these files and load them in the folder once it is created.

I think it can be done by copy activity but i am literally stuck and i don't know what to do

any ideas?...

2 Answers

There is no need to create a folder separately. We can specify folder name in directory field of Sink dataset. If the specified folder does not exist, a folder will be created, and file will be copied to it.

Please follow below steps:

Step1: add source to Azure data factory

Ref1

Step2: Create Set variable Add name and Value.

Ref2

Step3: Go to sink add Storage account and select Json format.

Step4: Open Json file -> Add parameter name and string type -> connection add dynamic Contant.

ref3

Ref4

Ref5

Step5: Go to Sink, you will find Parameter name and add dynamic content of Set variable.

Ref6

This is the output of Storage account.

Ref7

Note: Edit the value for set variable activity to give required dynamic name ( I used 'output' as value for demonstration) for your output folder.

I was able to solve it as follows

enter image description here

The data set was modified configuring the name of the folder and the name of the json file through parameters.

enter image description here

On the side of the sink, both the extraction of the json file and the name of the file that are in two variables configured in the pipeline are configured.

enter image description here

this is the result.

enter image description here

Related