skip to Main Content

I am trying to ingest several tables incrementally in a pipeline on Azure Synapse using a ForEach Activity.

I have defined a variable as an array of strings. Each string corresponds to the name of a table that I want to query inside the ForEach and copy data from it.

My basic problem is how to pass as the table name at a SELECT query at the source of the Copy Activity, the @item that iterates in the ForEach.

*My connection to the MySQL database is established via ODBC.

2

Answers


  1. enter image description hereLet’s say you have two tables named as dimcustomer,dimpersondetail.

    1. You can put these two values in a array-type variable
      2.you can use the command @concat(‘select * from ‘,item()) in the source query.
      Please refer to the screenshots attached.
    Login or Signup to reply.
  2. In the copy activity which is inside the for-each activity, instead of giving query as select * from @item(), give select * from {@item()}.

    I tried to repro this in my environment. Below are the steps.

    • A variable named list is created and two sample table names T3, T4 are given as default value.

    enter image description here

    • In for each activity Items, @variables('list') is given

    enter image description here

    • Inside for each activity, a lookup activity and copy activity is added.

    enter image description here

    • In copy activity, Query is given as
      select * from @{item()} where datet > '@{activity('Lookup1').output.firstRow. datet}

    enter image description here

    • All activities inside for-each got executed successfully.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search