Copy Multiple Tables in Bulk by Using Azure Data Factory
Copy Multiple Tables in Bulk by Using Azure Data Factory
Note: (You can apply the same pattern in other copy scenarios as well. For example, copying
tables from SQL Server/Oracle to Azure SQL Database/Data Warehouse/Azure Blob, copying
different paths from Blob to Azure SQL Database tables)
Pipeline-2-IterateAndCopySQLTables & Pipeline-1-GetTableListAndTriggerCopyData
End-to-end workflow
In this scenario, you have a number of tables in Azure SQL Database that you want to copy
to SQL Data Warehouse. Here is the logical sequence of steps in the workflow that happens
in pipelines:
The first pipeline looks up the list of tables that needs to be copied over to the
sink data stores. Alternatively you can maintain a metadata table that lists all the
tables to be copied to the sink data store. Then, the pipeline triggers another pipeline,
which iterates over each table in the database and performs the data copy operation.
The second pipeline performs the actual copy. It takes the list of tables as a
parameter. For each table in the list, copy the specific table in Azure SQL Database to
the corresponding table in SQL Data Warehouse using staged copy via Blob storage
and PolyBase for best performance.
In this example, the first pipeline passes the list of tables as a value for the
parameter.
Prerequisites:
Create a SQL DB with blank DB:
c1 varchar(20) null,
c2 varchar(20) null
c1 varchar(20) null,
c2 varchar(20) null
NOTE: Select any table for Table. This table is a dummy table. You specify a query on the
source dataset when creating a pipeline. The query is used to extract data from the Azure
SQL database.
OR
Alternatively, you can click Edit check box, and enter dummyName as the table name
Create SQL DW dataset: Name it “Sql_DW_Target_Dataset”
Go to Parameter Tab Pass a parameter “DWTableName”
Note: If you copy/paste this name from the file, ensure that there is no trailing space
character at the end of DWTableName
Go to Connections Select Linked Service Click on Edit and then on Text box Add Dynamic
Content Click on “DWTableName” parameter Finish.
Create Pipeline:
In the General tab, specify Pipeline-2-IterateAndCopySQLTables for
name.
Values [@{item().TABLE_SCHEMA}].[@{item().TABLE_NAME}]
Looks up the Azure SQL Database system table to get the list of tables to be
copied.
Triggers the pipeline Pipeline-2-IterateAndCopySQLTables to do the actual
data copy.
Select Pipeline-1-IterateAndCopySQLTables for Invoked pipeline.
Expand the Advanced section.
Enter tableList for parameter name.
Click VALUE input box -> select the Add dynamic content below ->
enter @activity('LookupTableList').output.value as table name value ->
select Finish. You are setting the result list from the Lookup activity as an input to
the second pipeline. The result list contains the list of tables whose data needs to be
copied to the destination.
Connect Look Up Activity and Execute Pipeline: