gpt4 book ai didi

使用 utcnow() 作为管道参数的 Azure 数据工厂 v2

转载 作者:行者123 更新时间:2023-12-02 08:06:29 25 4
gpt4 key购买 nike

就上下文而言,我目前有一个数据工厂 v2 管道,其中包含一个调用复制事件ForEach Activity复制事件只是将数据从 FTP 服务器复制到 Blob 存储容器。

这是管道 json 文件:

{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "ForEach1",
"type": "ForEach",
"typeProperties": {
"items": {
"value": "@pipeline().parameters.InputParams",
"type": "Expression"
},
"isSequential": true,
"activities": [
{
"name": "Copy1",
"type": "Copy",
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false
},
"typeProperties": {
"source": {
"type": "FileSystemSource",
"recursive": true
},
"sink": {
"type": "BlobSink"
},
"enableStaging": false,
"cloudDataMovementUnits": 0
},
"inputs": [
{
"referenceName": "FtpDataset",
"type": "DatasetReference",
"parameters": {
"FtpFileName": "@item().FtpFileName",
"FtpFolderPath": "@item().FtpFolderPath"
}
}
],
"outputs": [
{
"referenceName": "BlobDataset",
"type": "DatasetReference",
"parameters": {
"BlobFileName": "@item().BlobFileName",
"BlobFolderPath": "@item().BlobFolderPath"
}
}
]
}
]
}
}
],
"parameters": {
"InputParams": {
"type": "Array",
"defaultValue": [
{
"FtpFolderPath": "/Folder1/",
"FtpFileName": "@concat('File_',formatDateTime(utcnow(), 'yyyyMMdd'), '.txt')",
"BlobFolderPath": "blobfolderpath",
"BlobFileName": "blobfile1"
},
{
"FtpFolderPath": "/Folder2/",
"FtpFileName": "@concat('File_',formatDateTime(utcnow(), 'yyyyMMdd'), '.txt')",
"BlobFolderPath": "blobfolderpath",
"BlobFileName": "blobfile2"
}
]
}
}
},
"type": "Microsoft.DataFactory/factories/pipelines"
}

我遇到的问题是,在指定管道参数时,我似乎无法像为 blob 存储数据集指定文件夹路径那样使用系统变量和函数。这样做的结果是 formatDateTime(utcnow(), 'yyyyMMdd') 不会被解释为函数调用,而是具有值 formatDateTime(utcnow(), 'yyyyMMdd') 的实际字符串.

为了解决这个问题,我猜测我应该使用触发器来执行管道,并将触发器的执行时间作为参数传递给管道,例如 trigger().startTime 但这是唯一的方法吗?我只是在管道的 JSON 中做错了什么吗?

最佳答案

这应该有效:File_@{formatDateTime(utcnow(), 'yyyyMMdd')}

或者复杂的路径:

rootfolder/subfolder/@{formatDateTime(utcnow(),'yyyy')}/@{formatDateTime(utcnow(),'MM')}/@{formatDateTime(utcnow(),'dd')}/@{formatDateTime(utcnow(),'HH')}

关于使用 utcnow() 作为管道参数的 Azure 数据工厂 v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50986738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com