Hello Rohant, Welcome to MS Q&A
To pass a dynamically generated file name from a Copy Data activity to a Transform Activity in Azure Data Factory, you can use the following approach:
- Generate the File Name in the Copy Data Activity:
- In the Copy Data activity, use the dynamic content feature to generate the file name. For example, you can use expressions to include the activity name, date, and time in the file name.
- Store the File Name in a Variable:
- Create a pipeline variable to store the generated file name. You can use the Set Variable activity to assign the generated file name to this variable.
- Pass the Variable to the Transform Activity:
- In the Transform Activity, use the variable containing the file name as a parameter. You can reference the variable in the activity's settings or script
Example Pipeline JSON:
{
"name": "ExamplePipeline",
"properties": {
"activities": [
{
"name": "CopyDataActivity",
"type": "Copy",
"inputs": [
{
"referenceName": "SourceDataset",
"type": "DatasetReference"
}
],
"outputs": [
{
"referenceName": "SinkDataset",
"type": "DatasetReference"
}
],
"sink": {
"type": "BlobSink",
"storeSettings": {
"type": "AzureBlobFSWriteSettings"
},
"formatSettings": {
"type": "JsonWriteSettings"
},
"fileName": {
"value": "@concat(activity('CopyDataActivity').name, '__', formatDateTime(utcnow(), 'yyyyMMddHHmmss'), '._json')",
"type": "Expression"
}
}
},
{
"name": "SetFileNameVariable",
"type": "SetVariable",
"variables": {
"FileName": {
"value": "@concat(activity('CopyDataActivity').name, '__', formatDateTime(utcnow(), 'yyyyMMddHHmmss'), '._json')",
"type": "Expression"
}
}
},
{
"name": "TransformActivity",
"type": "DataFlow",
"dependsOn": [
{
"activity": "SetFileNameVariable",
"dependencyConditions": [
"Succeeded"
]
}
],
"userProperties": [],
"typeProperties": {
"dataFlow": {
"referenceName": "YourDataFlow",
"type": "DataFlowReference"
},
"parameters": {
"FileName": {
"value": "@variables('FileName')",
"type": "Expression"
}
}
}
}
]
}
}
This example demonstrates how to generate a file name dynamically, store it in a variable, and pass it to a subsequent Transform Activity in Azure Data Factory
Please let us know if any questions
Kindly accept answer if it helps
Thanks
Deepanshu