For the below scenario where the left side is my source and the Right side is the destination:
Source Destination
---------- -----------------
sourceContainer/StaticFiles/Finance/X1.tsv DestinationContainer/StaticFiles/Finance/X1.tsv
sourceContainer/StaticFiles/Customer/X2.tsv DestinationContainer/StaticFiles/Customer/X2.tsv
I would want to place files at any of the source locations one at a time and it should trigger a copy pipeline to create path dynamically for destination. I have used one copy activity in a pipeline where I have created triggers for each like Finance and Customer.
I have referred to the below link, but no luck https://docs.microsoft.com/en-us/azure/data-factory/how-to-create-event-trigger
We need use Get Metadata and ForEach activities to achieve that. I created a simple test to copy files and create path dynamically for destination.
First, we need to add a event trigger. Specify your container and path.
At Get Metadata1, select the dataset declared previously, then select Child items.
At ForEach1 activity, add dynamic content @activity('Get Metadata1').output.childItems
to the Items .
Inside ForEach1 activity, we can define a Copy activity. Select Wildcard file path and add StaticFiles
to the path.
At sink tab, we create a dataset to the destination container. Here is output
. Then add dynamic content and type in @item().name
. It will create path dynamically for destination.
Debug:
The pipeline triggered when I upload a file to the StaticFiles/finance
folder. We can see it created path dynamically for destination.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.