I am currently reading a SQL Table which has more than 5000 records. Since Lookup activity doesnt support more than 5000 Records. I had to create a foreach loop which will iterate based on totalrecords/5000 and inside lookup will fetch first 5000 records then for next ietration it will fetch another 5000 and so on. however i am stuck on how to pass the each lookup activity output array to a variable.
My Pipeline look like this.
{
“name”: “pipeline2”,
“properties”: {
“activities”: [
{
“name”: “GetRowCount_FromMyTable”,
“type”: “Lookup”,
“dependsOn”: [],
“policy”: {
“retry”: 0,
“retryIntervalInSeconds”: 30,
“secureOutput”: false,
“secureInput”: false
},
“userProperties”: [],
“typeProperties”: {
“source”: {
“type”: “AzureSqlSource”,
“sqlReaderQuery”: {
“value”: “SELECT COUNT(*) as TotalCount FROM MyTable”,
“type”: “Expression”
},
“queryTimeout”: “02:00:00”,
“partitionOption”: “None”
},
“dataset”: {
“referenceName”: “ds_sql_extraction”,
“type”: “DatasetReference”
}
},
“inputs”: [
{
“referenceName”: “ds_sql_extraction”,
“type”: “DatasetReference”
}
],
“linkedServiceName”: {
“referenceName”: “MyDatabase”,
“type”: “LinkedServiceReference”
}
},
{
“name”: “IterativeLookup”,
“type”: “ForEach”,
“dependsOn”: [
{
“activity”: “GetRowCount_OffSetTable”,
“dependencyConditions”: [
“Succeeded”
]
}
],
“userProperties”: [],
“typeProperties”: {
“items”: {
“value”: “@range(0, add(div(activity(‘GetRowCount_OffSetTable’).output.firstRow.TotalCount, 5000), 1))”,
“type”: “Expression”
},
“activities”: [
{
“name”: “LookupActivity”,
“type”: “Lookup”,
“dependsOn”: [],
“policy”: {
“retry”: 0,
“retryIntervalInSeconds”: 30,
“secureOutput”: false,
“secureInput”: false
},
“userProperties”: [
{
“name”: “LookupIterations”,
“value”: “@{item()}”
}
],
“typeProperties”: {
“source”: {
“type”: “AzureSqlSource”,
“sqlReaderQuery”: {
“value”: “SELECT * FROM MyTable ORDER BY OffsetValue OFFSET @{mul(int(item()), 5000)} ROWS FETCH NEXT 5000 ROWS ONLYnn”,
“type”: “Expression”
},
“queryTimeout”: “02:00:00”,
“partitionOption”: “None”
},
“dataset”: {
“referenceName”: “ds_sql_extraction”,
“type”: “DatasetReference”
},
“firstRowOnly”: false
},
“inputs”: [
{
“referenceName”: “ds_sql_extraction”,
“type”: “DatasetReference”
}
]
},
{
“name”: “Set variable1”,
“type”: “SetVariable”,
“dependsOn”: [
{
“activity”: “LookupActivity”,
“dependencyConditions”: [
“Succeeded”
]
}
],
“policy”: {
“secureOutput”: false,
“secureInput”: false
},
“userProperties”: [],
“typeProperties”: {
“variableName”: “LookupArray”,
“value”: {
“value”: “@string(item().value)”,
“type”: “Expression”
}
}
}
]
}
}
],
“variables”: {
“LookupArray”: {
“type”: “Array”
},
“AnotherArray”: {
“type”: “Array”
},
“LookupString”: {
“type”: “String”
},
“Stringg”: {
“type”: “Array”
},
“Test”: {
“type”: “String”
},
“test2”: {
“type”: “Array”
},
“test1”: {
“type”: “String”
},
“NewArraySet”: {
“type”: “Array”
}
},
“folder”: {
“name”: “Data_Extraction”
},
“annotations”: []
}
}
how to get the two LookupActivity (Iterated) outputs to one single variable?
user25299890 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.