Total Page Preview: 000000001108
What is foreach activity in azure data factory with demo
ForEach Activity in Azure Data Factory in English:
In Azure Data Factory, you can use the ForEach activity to iterate over a collection of items and perform an action for each item in the collection.
Here are the steps to use the ForEach activity in Azure Data Factory:
-
Drag and drop the ForEach activity onto the pipeline canvas.
-
Configure the settings for the ForEach activity, including the input dataset or array, the item name, and the activity to perform for each item.
-
Inside the ForEach activity, you can add one or more activities to perform for each item in the input dataset or array.
-
In the activity settings, you can use the item name variable to reference the current item being processed in the iteration.
Here's an example of how to use the ForEach activity in Azure Data Factory:
Suppose you have a list of files stored in Azure Blob Storage, and you want to copy each file to a different location. You can use the ForEach activity to iterate over the list of files and perform the copy activity for each file.
-
Add a Blob Storage dataset that points to the folder containing the files you want to copy.
-
Add a ForEach activity to the pipeline canvas.
-
Configure the ForEach activity to use the Blob Storage dataset as the input dataset, and set the item name to "file".
-
Inside the ForEach activity, add a Copy Data activity that copies the "file" variable to the desired destination.
-
Save and execute the pipeline.
The ForEach activity will iterate over each file in the Blob Storage folder and perform the copy activity for each file.
ForEach Activity in Azure Data Factory in Hindi:
Azure Data Factory mein, ForEach activity ka upyog ek collection of items ke upar iterate karne ke liye kiya jata hai aur har item ke liye ek action perform kiya jata hai.
Azure Data Factory mein ForEach activity ka upyog karne ke liye yeh kadam hai:
-
Pipeline canvas par ForEach activity ko drag and drop karen.
-
ForEach activity ke settings configure karen, jisme input dataset ya array, item name, aur har item ke liye perform karne wali activity shamil ho.
-
ForEach activity ke andar, aap ek ya adhik activities ko add kar sakte hain, jise iteration mein process karne ke liye kiya jayega.
-
Activity settings mein, aap item name variable ka upyog kar sakte hain, jise iteration mein current item ko reference karne ke liye use kiya ja sakta hai.
Yahan Azure Data Factory mein ForEach activity ka upyog karne ka ek udaharan hai:
Maan lijiye aapke paas Azure Blob Storage mein store kiye gaye kuchh files ki list hai aur aap har file ko ek alag jagah par copy karna chahte hain. Aap ForEach activity ka upyog karke files ki list ko iterate kar sakte hain aur har file ke liye copy activity perform kar sakte hain.
-
Blob Storage dataset ko add karen, jo files ko copy karne ke liye use kiya jayega.
-
Pipeline canvas par ForEach activity add karen.
-
ForEach activity ko configure karen Blob Storage dataset ko input dataset ke roop mein use karke aur item name ko "file" set karen.
-
ForEach activity ke andar, Copy Data activity add karen, jo "file" variable ko desired destination par copy karegi.
-
Pipeline ko save aur execute karen.
ForEach activity Blob Storage folder mein har file ke liye iterate karega aur har file ke liye copy activity perform karega.
Create arrey type variable with default value:
Select the new ForEach activity on the canvas if it is not already selected, and its Settings tab, to edit its details.
Select the Items field and then select the Add dynamic content link to open the dynamic content editor pane.
Select your input array to be filtered in the dynamic content editor. In this example, we select the variable created in the first step.
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com