Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Data Factory specify custom output filename when copying to Blob Storage

I'm currently using ADF to copy files from an SFTP server to Blob Storage on a scheduled basis.

The filename structure is AAAAAA_BBBBBB_CCCCCC.txt.

Is it possible to rename the file before copying to Blob Storage so that I end up with a folder-like structure like below?

AAAAAA/BBBBBB/CCCCCC.txt

like image 702
Florin D. Preda Avatar asked Oct 25 '17 17:10

Florin D. Preda


1 Answers

Here is what worked for me

I created 3 parameters in my Blob storage dataset, see the image bellow: screenshot of my parameters

I specified the name of my file, added the file extension, you can add anything in the Timestamp just so you could bypass the ADF requirement since a parameter can't be empty.

Next, click on the Connection tab and add the following code in the FileName box: @concat(dataset().FileName,dataset().Timestamp,dataset().FileExtension). This code basically concatenate all parameters do you could have something like "FileName_Timestamp_FileExtension. See the image bellow:

Blob dataset connection tab

Next, click on your pipeline then select your copy data activity. Click on the Sink tab. Find the parameter Timestamp under Dataset properties and add this code: @pipeline().TriggerTime. See the image bellow:

copy data activity

Finally, publish your pipeline and run/debug it. If it worked for me then I am sure it will work for you as well :)

like image 62
William Avatar answered Oct 08 '22 02:10

William