1

I have several DB tables and would like to loop over them and then pass table name to next activity.

I tried using ADFv2. But im confused, how to loop over names.

I have tried putting names as Arrays in Pipeline Parameters. But it didn't work.

Can you provide some info. how to achieve this?

Thank you.

1 Answers1

1

What you are looking for is the lookup activity. What you should do is a Lookup Activity that brings all the table names, and then a foreach activity that uses each table name as the item. Something like this:

enter image description here

In the Lookup Activity you will use a query that brings you every table you want to loop over, for example (Sql Server):

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'

Then, in the ForEach activity you will go to settings, and in the Item box use something like:

@activity('Lookup1').output.TABLE_NAME

This way, each iteration of the ForEach activity will the outputs of the lookup. Then, just double click on the foreach activity and do whatever you need to do. To reference the item inside of the foreach simply use @item().

Hope this helped! Here is the documentation on these kind of activities

https://learn.microsoft.com/en-us/azure/data-factory/control-flow-lookup-activity

https://learn.microsoft.com/en-us/azure/data-factory/control-flow-for-each-activity

Martin Esteban Zurita
  • 3,161
  • 12
  • 23
  • thanks that was a nice idea to use lookup. Earlier, i was passing everything as an array. Which was working, although this is way better. –  Aug 30 '19 at 10:03