Search code examples
azureazure-data-factory

Capture folder name from blob using mapping data flow in ADF


I have a dataflow that's reading data from Azure blob storage and loading it to SQL table. I need to create a column that identifies the file coming from the blob folder and load the folder name to the table. Im using derived column in the data flow, but not able to retrieve the folder name from the blob.

Please let me know how to solve this.


Solution

  • You can use Column to store file name in the Source options of the Dataflow.

    enter image description here

    It will create a column and stores the file path from root folder.

    enter image description here

    To get the folder name which contains the file name, use derived column and give the below expression.

    split(filepath,'/')[minus(size(split(filepath,'/')),1)]
    

    enter image description here

    Now, transform these to your SQL target table.