I have a pipeline (PL_Main) containing a set of Execute pipeline activities in sequence, as the below image depicts:
Now, I was trying to create an activity (executed after PL_Main completion) that allowed me to understand if any of the 'childs' Execute Pipeline activities (PL_1, PL_2, PL3.1, PL_3.2) failed.
However, according my understanding thee pipelines output contains only the RunId and PipelineName. Is there a way that I can find what were the pipelines in my execution chain that failed (or at least the 1st one failling) and store their RunId in as a parameter for my next activity (New Activity) ?
Thanks in advance to everybody!
Assuming you need to pass the pipelinerunid of the failed activity within Main pipeline, you need to deign the pipeline in below way :
JSON:
{
"name": "pipeline8",
"properties": {
"activities": [
{
"name": "Execute Pipeline1",
"type": "ExecutePipeline",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pipeline7",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
},
{
"name": "Execute Pipeline2",
"type": "ExecutePipeline",
"dependsOn": [
{
"activity": "Execute Pipeline1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pipeline9",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
},
{
"name": "Execute Pipeline3",
"type": "ExecutePipeline",
"dependsOn": [
{
"activity": "Execute Pipeline2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pipeline10",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
},
{
"name": "Execute Pipeline4",
"type": "ExecutePipeline",
"dependsOn": [
{
"activity": "Execute Pipeline2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pipeline11",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
},
{
"name": "Fail1",
"type": "Fail",
"dependsOn": [
{
"activity": "Execute Pipeline1",
"dependencyConditions": [
"Failed"
]
}
],
"userProperties": [],
"typeProperties": {
"message": {
"value": "#activity('Execute Pipeline1').output.pipelineRunId",
"type": "Expression"
},
"errorCode": "1"
}
},
{
"name": "Fail2",
"type": "Fail",
"dependsOn": [
{
"activity": "Execute Pipeline2",
"dependencyConditions": [
"Failed"
]
}
],
"userProperties": [],
"typeProperties": {
"message": {
"value": "#activity('Execute Pipeline2').output.pipelineRunId",
"type": "Expression"
},
"errorCode": "2"
}
},
{
"name": "Fail3",
"type": "Fail",
"dependsOn": [
{
"activity": "Execute Pipeline3",
"dependencyConditions": [
"Failed"
]
},
{
"activity": "Fail5",
"dependencyConditions": [
"Skipped"
]
}
],
"userProperties": [],
"typeProperties": {
"message": "#activity('Execute Pipeline3').output.pipelineRunId",
"errorCode": "1"
}
},
{
"name": "Fail4",
"type": "Fail",
"dependsOn": [
{
"activity": "Execute Pipeline4",
"dependencyConditions": [
"Failed"
]
},
{
"activity": "Fail5",
"dependencyConditions": [
"Skipped"
]
}
],
"userProperties": [],
"typeProperties": {
"message": "#activity('Execute Pipeline4').output.pipelineRunId",
"errorCode": "4"
}
},
{
"name": "Fail5",
"type": "Fail",
"dependsOn": [
{
"activity": "Execute Pipeline3",
"dependencyConditions": [
"Failed"
]
},
{
"activity": "Execute Pipeline4",
"dependencyConditions": [
"Failed"
]
}
],
"userProperties": [],
"typeProperties": {
"message": {
"value": "#concat(activity('Execute Pipeline3').output.pipelineRunId,';',activity('Execute Pipeline4').output.pipelineRunId)",
"type": "Expression"
},
"errorCode": "5"
}
}
],
"variables": {
"test": {
"type": "String"
},
"spt": {
"type": "Array"
},
"final": {
"type": "String"
}
},
"annotations": []
}
}
Reference blog : https://datasharkx.wordpress.com/2021/08/19/error-logging-and-the-art-of-avoiding-redundant-activities-in-azure-data-factory/
Note: the fail activities capture the pipelinerunid
Finaly to capture the ID:
#activity('Execute Pipeline1').error.message
You can try this approach also, to get the failed pipeline run id.
For this name the Execute pipeline activities name same as child pipeline names.
First get the Failed Execute pipeline activity name (Pipeline name) in the main pipeline using the error message.
Error message:
Use set variable to get this.
Get the pipeline name from the error message.
use the below expression for that.
#substring(variables('error'), add(indexOf(variables('error'),'target'),7), sub(indexOf(variables('error'),' failed'),add(indexOf(variables('error'),'target'),7)))
You can see that we got the pipeline name in the variable
Now get all the pipeline runs from the Pipeline Runs - Query By Factory command.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryPipelineRuns?api-version=2018-06-01
Use this in web activity.
This will give you all pipeline runs details with names and run ids Json which you can see in the above documentation.
Now compare our pipeline name from variable in this JSON and get that particular run id which is our required failed pipeline run id. Use ForEach activity or filter for that.
Reference:
Check this SO thread for reference by KarthikBhyresh-MT
Related
Documenting here what I learned, in case it helps someone else. I had a ARM template implementing a DataFactory pipeline, which had a weird InvalidTemplate error. I am simplifying my template to a contrived bare bones template,
resources: [
{
"name": "blah",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"activities": [
{
"name": "Foo",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "hi",
"value": {
"value": "int(1)",
"type": "Expression"
}
}
},
{
"name": "CoolIf",
"type": "IfCondition",
"typeProperties": {
"expression": {
"value": "#bool(equals(variables('hi'), 1))",
"type": "Expression"
},
"ifTrueActivities": [
{
"name": "Blarg",
"type": "SetVariable",
"dependsOn": [{"activity": "Foo"}],
"userProperties": [],
"typeProperties": {
"variableName": "okay",
"value": {
"value": "#string(1 + int(variables('hi')))",
"type": "Expression"
}
}
},
],
"ifFalseActivities": []
}
}
]
}
}
]
produced the error message
ErrorCode=InvalidTemplate, ErrorMessage=The template validation
failed: 'The 'runAfter' property of template action 'BlargScope'
is not valid: the action 'FooScope' must belong to same level as
action 'BlargScope'. Available actions on same level: ''
I could not find a good answer online.
After a day of trial and error I realized you can put a dependsOn in the IfCondition parent, so below, just moves the dependsOn from the child Blarg to the parent CoolIf. And then it started working =) .
resources: [
{
"name": "blah",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"activities": [
{
"name": "Foo",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "hi",
"value": {
"value": "int(1)",
"type": "Expression"
}
}
},
{
"name": "CoolIf",
"type": "IfCondition",
"dependsOn": [{"activity": "Foo"}],
"typeProperties": {
"expression": {
"value": "#bool(equals(variables('hi'), 1))",
"type": "Expression"
},
"ifTrueActivities": [
{
"name": "Blarg",
"type": "SetVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "okay",
"value": {
"value": "#string(1 + int(variables('hi')))",
"type": "Expression"
}
}
},
],
"ifFalseActivities": []
}
}
]
}
}
]
In retrospect I feel silly how simple this was haha.
I have multiple XMLs in an Azure Blob. I want to extract certain datapoints and sort them into an Azure SQL db.
For this I use Data Flow. The name of certain elements changes sometimes [random name] so i would like to set up a rule-based mapping, that fetches the right values every time .
I want to retrieve IMPORTANT INFORMATION, which is always located in the first randomly named child of category_a.
Apart from the randomly named object the rest of the structure always stays the same.
This is about the structure:
<title>
<category_a>
<random_name_1>
<object_a>
<subobject_object_a>
<p>IMPORTANT INFORMATION</p>
</subobject_object_a>
</object_a>
</random_name_1>
<random_name_2>
<object_a>
<subobject_object_a>
<p>IRRELEVANT INFORMATION</p>
</subobject_object_a>
</object_a>
</random_name_2>
</category_a>
<category_b></category_b>
How do I need to write the rule based mapping so that I always fetch this value no matter the random name in the middle of the path?
Thanks for your help
There might be no option to find or use rule-based mapping to retrieve the important information. As a work around, I have used lookup and string manipulation activities to get the result. The following is the pipeline JSON:
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Lookup1",
"type": "Lookup",
"dependsOn": [],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "XmlSource",
"storeSettings": {
"type": "AzureBlobFSReadSettings",
"recursive": true,
"enablePartitionDiscovery": false
},
"formatSettings": {
"type": "XmlReadSettings",
"validationMode": "none",
"namespaces": true
}
},
"dataset": {
"referenceName": "Xml1",
"type": "DatasetReference"
},
"firstRowOnly": false
}
},
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Lookup1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "tp",
"value": {
"value": "#replace(replace(split(string(activity('Lookup1').output.value[0].title.category_a),':')[0],'\"',''),'{','')",
"type": "Expression"
}
}
},
{
"name": "Set variable2",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Set variable1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "tp2",
"value": {
"value": "#replace(replace(split(string(activity('Lookup1').output.value[0].title.category_a[variables('tp')]),':')[0],'\"',''),'{','')",
"type": "Expression"
}
}
},
{
"name": "Set variable3",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Set variable2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "tp3",
"value": {
"value": "#replace(replace(split(string(activity('Lookup1').output.value[0].title.category_a[variables('tp')][variables('tp2')]),':')[0],'\"',''),'{','')",
"type": "Expression"
}
}
},
{
"name": "Set variable4",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Set variable3",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "tp4",
"value": {
"value": "#replace(replace(split(string(activity('Lookup1').output.value[0].title.category_a[variables('tp')][variables('tp2')][variables('tp3')]),':')[0],'\"',''),'{','')",
"type": "Expression"
}
}
},
{
"name": "Set variable5",
"type": "SetVariable",
"dependsOn": [
{
"activity": "Set variable4",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "final",
"value": {
"value": "#activity('Lookup1').output.value[0].title.category_a[variables('tp')][variables('tp2')][variables('tp3')][variables('tp4')]",
"type": "Expression"
}
}
}
],
"variables": {
"tp": {
"type": "String"
},
"tp2": {
"type": "String"
},
"tp3": {
"type": "String"
},
"tp4": {
"type": "String"
},
"final": {
"type": "String"
}
},
"annotations": []
}
}
The lookup has the source xml file. Since we know the category_a is a child element, I have started from there to obtain the child element names (in each set variable activity).
The following is the output image for reference:
I'm working with a dataset where I need to drop some columns which contain only NULL values. The issue is that the column names are not consistent or similar, and can change with time. I was wondering if there is a way in ADF to drop a column if all instances are NULL without having drifted columns?
I have tried unpivoting, removing rows, then re-pivoting, however after I pivot the data back to its original format, I get the following message:
"This drifted column is not in the source schema and therefore can only be referenced with pattern matching expressions"
The drifted columns don't seem to join on subsequent join functions. I have also tried setting derived columns with regex column patters to make all the drifted columns explicit, however, the byName() function doesn't seem to work with the $$ syntax; namely:
toString(byName($$))
Any ideas of how to solve this within Azure Data Factory - Data Flows would be very much appreciated!
I have used combination of both data factory pipeline activities and dataflow to achieve the requirement.
First, I have taken dataflow to output a file. I have added a new column with all values as 1 so that I can use aggregate on all other rows using this new column to group.
I have used collect() to create an array for each of the column where group by is on above created column.
Now create another derived column to replace the array by converting array to string and calculating length. If length is 2 it indicates that column contains all nulls.
Write this dataflow output to a file. The data preview of the sink will be as follows:
Create a dataflow activity to run the above dataflow and pass the following dynamic content in execute pipeline activity to filter out and write data of only required columns.
#activity('Data flow1').output.runstatus.profile.sink1.total
In pipeline2, I have used activities to get columns that are not entirely nulls, create a dynamic schema and then use this schema as mapping and write to a file only the required columns.
First, I have read the file written at the end of dataflow without header (even though the file has header). The dataset looks as shown below:
You can directly use the following pipeline JSON to build the pipeline:
{
"name": "pipeline2",
"properties": {
"activities": [
{
"name": "Lookup1",
"type": "Lookup",
"dependsOn": [],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "DelimitedTextSource",
"storeSettings": {
"type": "AzureBlobFSReadSettings",
"recursive": true,
"enablePartitionDiscovery": false
},
"formatSettings": {
"type": "DelimitedTextReadSettings"
}
},
"dataset": {
"referenceName": "cols",
"type": "DatasetReference"
},
"firstRowOnly": false
}
},
{
"name": "ForEach1",
"type": "ForEach",
"dependsOn": [
{
"activity": "Lookup1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#range(0,pipeline().parameters.count_of_rows)",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Append variable1",
"type": "AppendVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "props",
"value": {
"value": "Prop_#{item()}",
"type": "Expression"
}
}
}
]
}
},
{
"name": "ForEach2",
"type": "ForEach",
"dependsOn": [
{
"activity": "ForEach1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#variables('props')",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Append variable2",
"type": "AppendVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "req_cols",
"value": {
"value": "#if(and(not(equals(activity('Lookup1').output.value[0][item()],'tp')),not(equals(activity('Lookup1').output.value[1][item()],'2'))),activity('Lookup1').output.value[0][item()],'')",
"type": "Expression"
}
}
}
]
}
},
{
"name": "Filter1",
"type": "Filter",
"dependsOn": [
{
"activity": "ForEach2",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#variables('req_cols')",
"type": "Expression"
},
"condition": {
"value": "#not(equals(item(),''))",
"type": "Expression"
}
}
},
{
"name": "ForEach3",
"type": "ForEach",
"dependsOn": [
{
"activity": "Filter1",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#activity('Filter1').output.Value",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Append variable3",
"type": "AppendVariable",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"variableName": "mapping",
"value": {
"value": "#json(concat('{\"source\":{\"name\":\"',item(),'\"},\"sink\":{\"name\":\"',item(),'\"}}'))",
"type": "Expression"
}
}
}
]
}
},
{
"name": "Set variable1",
"type": "SetVariable",
"dependsOn": [
{
"activity": "ForEach3",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"variableName": "dynamic_schema",
"value": {
"value": "#concat('{\"type\":\"TabularTranslator\",\"mappings\":',string(variables('mapping')),'}}')",
"type": "Expression"
}
}
},
{
"name": "Copy data1",
"type": "Copy",
"dependsOn": [
{
"activity": "Set variable1",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "DelimitedTextSource",
"storeSettings": {
"type": "AzureBlobFSReadSettings",
"recursive": true,
"enablePartitionDiscovery": false
},
"formatSettings": {
"type": "DelimitedTextReadSettings"
}
},
"sink": {
"type": "DelimitedTextSink",
"storeSettings": {
"type": "AzureBlobFSWriteSettings"
},
"formatSettings": {
"type": "DelimitedTextWriteSettings",
"quoteAllText": true,
"fileExtension": ".txt"
}
},
"enableStaging": false,
"translator": {
"value": "#json(variables('dynamic_schema'))",
"type": "Expression"
}
},
"inputs": [
{
"referenceName": "csv1",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "req_file",
"type": "DatasetReference"
}
]
}
],
"parameters": {
"count_of_rows": {
"type": "int"
}
},
"variables": {
"props": {
"type": "Array"
},
"req_cols": {
"type": "Array"
},
"test": {
"type": "String"
},
"mapping": {
"type": "Array"
},
"dynamic_schema": {
"type": "String"
}
},
"annotations": []
}
}
NOTE: In the copy data activity, the source is the original file.
If the source column names will change, then you have to use column patterns. When you match columns based on patterns, you can project those into columns using the Select transformation. Use the rule-based mapping option in the Select transformation with true() as the matching expression and $$ as the Name As property like this:
I have created Azure Data Factory using ARM template and then created datasets and pipelines into it.
In one of the pipelines, I have used the parameters(EmailTo, Subject) with hardcoded values like this below:
{
"name": "[concat(parameters('factoryName'), '/pl_xxxxxxxx')]",
"type": "Microsoft.DataFactory/factories/pipelines",
"apiVersion": "2018-06-01",
"properties": {
"activities": [
{
"name": "xxxxxxxxxx_Columns",
"type": "Lookup",
"dependsOn": [],
"policy": {
"timeout": "0.00:01:00",
"retry": 3,
"retryIntervalInSeconds": 60,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"source": {
"type": "SqlMISource",
"partitionOption": "None"
},
"dataset": {
"referenceName": "ds_xxxxxxxxxxx_New_Columns",
"type": "DatasetReference",
"parameters": {}
},
"firstRowOnly": false
}
},
{
"name": "foreach_New_Column",
"type": "ForEach",
"dependsOn": [
{
"activity": "lkp_xxxxxxxxx_New_Columns",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#activity('lkp_xxxxxxxxxxx_New_Columns').output.value",
"type": "Expression"
},
"activities": [
{
"name": "pl_Notify_xxxxxxxxxxx_New_Column",
"description": "Sends email to xxxxxxxxxxxx.",
"type": "ExecutePipeline",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "pl_xxxxxxxx_Email_Notification",
"type": "PipelineReference"
},
"waitOnCompletion": true,
"parameters": {
"EmailTo": "xyz1233#abc.com",
"ErrorMessage": {
"value": "#concat(item().TABLE_NAME, ',', item().COLUMN_NAME, ' has been added in xxx. Please review. Change will be processed to xxxxx automatically in 7 days.' )",
"type": "Expression"
},
"PipelineName": {
"value": "#pipeline().Pipeline",
"type": "Expression"
},
"Subject": {
"value": "xxxxxxxxxxxx",
"type": "Expression"
}
}
}
}
]
}
}
],
"folder": {
"name": "xxxx/Sub-Pipelines"
},
"annotations": [],
"lastPublishTime": "2021-09-01T19:40:30Z"
},
"dependsOn": [
]
},
I want to pass the dynamic values to the above parameters based on the environment (Dev, QA etc.….) for the above pipeline parameters.
You actually can use the task replacetokens in your release pipeline. It will replace tokens in files with variable values. You can first set all of your variables in libraries (DEV, QA, PROD, ...).
In the ARM template file, you need to specify the token prefix and token suffix like the following:
"EmailTo": ${emailAddress}$
In your YAML file, the task should look like this (using version 3 for instance):
- task: replacetoken#3
displayName: 'Replace variables'
inputs:
targetFiles: |
*.json
rootDirectory: '$(Pipeline.Workspace)/files'
tokenPrefix: '${'
tokenSuffix: '}$'
I am trying to use "Execute Pipeline" to invoke a Pipe which has a ForEach activity. I get an error.
Json for Execute pipe:
[
{
"name": "pipeline3",
"properties": {
"activities": [
{
"name": "Test_invoke1",
"type": "ExecutePipeline",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"pipeline": {
"referenceName": "MAIN_SA_copy1",
"type": "PipelineReference"
},
"waitOnCompletion": true
}
}
],
"annotations": []
}
}
]
Jason for Invoke pipe for each activity :
[
{
"name": "MAIN_SA_copy1",
"properties": {
"activities": [
{
"name": "Collect_SA_Data",
"type": "ForEach",
"dependsOn": [],
"userProperties": [],
"typeProperties": {
"items": {
"value": "#pipeline().parameters.TableNames",
"type": "Expression"
},
"batchCount": 15,
"activities": [
{
"name": "Sink_SAdata_toDL",
"type": "Copy",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [
{
"name": "Destination",
"value": "#{pipeline().parameters.DLFilePath}/#{item()}"
}
],
"typeProperties": {
"source": {
"type": "SqlServerSource",
"sqlReaderQuery": {
"value": "#concat('SELECT * FROM ',item())",
"type": "Expression"
}
},
"sink": {
"type": "AzureBlobFSSink"
},
"enableStaging": false,
"parallelCopies": 1,
"dataIntegrationUnits": 4
},
"inputs": [
{
"referenceName": "SrcDS_StructuringAnalytics",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "ADLS",
"type": "DatasetReference",
"parameters": {
"FilePath": "#pipeline().parameters.DLFilePath",
"FileName": {
"value": "#concat(item(),'.orc')",
"type": "Expression"
}
}
}
]
}
]
}
}
],
"parameters": {
"DLFilePath": {
"type": "string",
"defaultValue": "extracts/StructuringAnalytics"
},
"TableNames": {
"type": "array",
"defaultValue": [
"fom.FOMLineItem_manual"
]
}
},
"variables": {
"QryTableColumn": {
"type": "String"
},
"QryTable": {
"type": "String"
}
},
"folder": {
"name": "StructuringAnalytics"
},
"annotations": []
},
"type": "Microsoft.DataFactory/factories/pipelines"
}
]
I get an error:
[
{
"errorCode": "BadRequest",
"message": "Operation on target Collect_SA_Data failed: The execution of template action 'Collect_SA_Data' failed: the result of the evaluation of 'foreach' expression '#pipeline().parameters.TableNames' is of type 'String'. The result must be a valid array.",
"failureType": "UserError",
"target": "Test_invoke1",
"details": ""
}
]
Input:
"pipeline": {
"referenceName": "MAIN_SA_copy1",
"type": "PipelineReference"
},
"waitOnCompletion": true,
"parameters": {
"DLFilePath": "extracts/StructuringAnalytics",
"TableNames": "[\"fom.FOMLineItem_manual\"]"
}
Please try updating your dynamic expression of ForEach Items as below:
{
"value": "#array(pipeline().parameters.TableNames)",
"type": "Expression"
}
Hope this helps.
I guess you were using the UI to set the pipeline and its parameters and I guess you expected to put the array parameter of the called pipeline as everywhere else like this:
(It is all my guess, because I just did exactly the same, with the same result)
The trick is to define the array in the Code (["table1", "table2"]):
The input in the UI will look like this:
Now it works!
It seems, that the Datafactory is otherwise treating the whole array as one element of some array. Hence, the solution with the array() function sometimes works.
It looks like a bug, defining array parameter input..
(Had to edit the answer, I first thought omiting the colons in the UI input would be enough)