azure - 尝试在 azure 数据工厂中添加表达式并获取 'The template function ' 数据集'未定义或无效。'错误

标签 azure azure-data-factory

我试图向我的数据工厂数据集添加一些表达式并收到此错误:模板函数“数据集”未定义或无效。

我有管道参数的默认值:

"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/

相关文章:

sql-server - 使用 Rest-API 查询 Azure SQL 数据库

azure - Azure 应用服务中的 AppStateTracker 是什么?

sql - ADF - 迭代选择输出到复制事件

php - SimpleSAMLphp - SSO Azure 适用于 Firefox 和 Safari,但不适用于 Chrome 和 Edge

azure - 无法通过自动化帐户运行我的 ps 脚本

parameters - Azure 数据工厂 - 使用包参数执行 SSIS 包

azure - 在 Azure 数据工厂中捕获 HTTP 404

azure - 如何在数据工厂中接收http post?

sql-server - 如何根据源和目标的不同列名称在 Azure 数据工厂中使数据流列映射动态化?

azure - 如何手动续订 Azure Key Vault 中的证书