You need to use a Set Variable
activity before the Copy Data
activity to assign a value to the final_mapping
variable dynamically.
For the Copy Data
activity, it should references th final_mapping
variable correctly as an expression. The syntax for referencing variables dynamically in ADF requires the use of @{}
.
And then update the translator
section in the Copy Data
activity to reference the variable directly.
Your json should look like below :
"activities": [
{
"name": "SetFinalMapping",
"type": "SetVariable",
"typeProperties": {
"variableName": "final_mapping",
"value": {
"type": "Array",
"value": [
{
"source": {
"name": "variable1",
"type": "Decimal"
},
"sink": {
"name": "v1",
"type": "Decimal"
}
},
{
"source": {
"name": "variable2",
"type": "Guid"
},
"sink": {
"name": "v2",
"type": "Guid"
}
}
]
}
}
},
{
"name": "CopyDataWithDynamicMapping",
"type": "Copy",
"typeProperties": {
"source": {
"type": "ParquetSource"
},
"sink": {
"type": "YourSinkType"
},
"enableStaging": false,
"translator": {
"type": "TabularTranslator",
"mappings": {
"value": "@variables('final_mapping')",
"type": "Expression"
}
}
}
}
]