我试图向我的数据工厂数据集添加一些表达式并收到此错误:模板函数“数据集”未定义或无效。
我有管道参数的默认值:
"parameters": {
"adlFolder": {
"type": "String",
"defaultValue": "/somePath/"
},
我还有数据集参数:
"parameters": {
"month": {
"type": "String",
"defaultValue": ""
},
"date": {
"type": "String",
"defaultValue": ""
},
"dest": {
"type": "String",
"defaultValue": ""
}
},
在事件输出中,我将表达式设置为该数据集参数:
"parameters": {
"month": "@substring(string(dataset().date),5,2)",
"date": "@{string(utcnow('yyyy/MM/dd'))}",
"dest":"@concat(string(pipeline().parameters.adlFolder),'01')"}
在数据集中我有这个:
"folderPath": {
"value": "@{dataset().dest}",
"type": "Expression"
}
有人看出这里出了什么问题吗?我可以这样设置表达式吗?非常感谢您的任何反馈。
最佳答案
看起来您正在事件中引用数据集的参数,根据我的理解,这是不可能的。
Activity只能使用pipeline的参数,dataset也只能使用dataset自己的参数。如果您需要在事件和数据集中使用相同的值。我认为您需要在管道和数据集中指定参数,在管道和事件中使用管道的参数,在数据集中使用datasert的参数,然后将管道的参数映射到管道中数据集的参数。
请参阅此处的示例 ( https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions#examples )。
例如,使用
"inputs": [
{
"referenceName": "BlobDataset",
"parameters": {
"path": "@pipeline().parameters.inputPath"
},
"type": "DatasetReference"
}
],
将管道的参数 inputPath 映射到数据集的参数路径。然后在activity中使用@pipeline().inputPath,在dataset中使用@dataset().path(需要在pipeline和dataset中分别指定)。
关于azure - 尝试在 azure 数据工厂中添加表达式并获取 'The template function ' 数据集'未定义或无效。'错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48903732/