azureazure-data-factoryazure-storageazure-table-storage

How to get full list of tables if count is big in the adf web activity?


We have 18,000 tables in the Table Storage Account.

I have created a web activity to list the tables in the storage account:

enter image description here

Web Activity - ListTables

URL: @concat('https://stccuatuks001.blob.core.windows.net/?comp=list', pipeline().parameters.sourceSAS)
Headers: Accept-application/json # Add as dynamic content value
Method: GET

sourceSAS is the storage account SAS token generated for table storage service and this value is given in the pipeline parameters.

I have run the pipeline where I'm getting only list of 1st 1000 tables, not more than that.

How do I get complete 18,000 list of table names in the output from the web activity or do I need to add any additional steps/configuration for it?


Solution

  • To list more than 1000 tables through ADF, you can follow the procedure below:

    After running the web activity, save the x-ms-continuation-NextTableName header value. Add a SetVariable activity with the continuation variable to save the value with the dynamic expression in SetVariable: @activity('Web1').output.ADFWebActivityResponseHeaders['x-ms-continuation-NextTableName'], as shown below:

    enter image description here

    Add an Until activity to the SetVariable activity with the expression @equals(coalesce(variables('continution'),'cs'),'cs'). Inside the Until activity, add the following activities:

    Add a web activity with the same URL used in the first web activity, but with &NextTableName=<variable> added, as shown below:

    @concat('https://stccuatuks001.blob.core.windows.net/?comp=list','&NextTableName=',variables('continution'), pipeline().parameters.sourceSAS)
    

    Add an Append Variable activity with an array variable list and the dynamic expression @activity('Web2').output.value, as shown below:

    enter image description here

    Add a SetVariable activity with the continuation variable and the dynamic expression @activity('Web2').output.ADFWebActivityResponseHeaders['x-ms-continuation-NextTableName'].

    After the Until activity is complete, you will have a list of all table names in the list variable.

    For more information, you can refer to a similar question in Q&A.