Azure 数据工厂从 foreach 值获取数据
Azure Data Factory get data from foreach value
我有一个查找 activity 从 blob 中的容器获取值。我有一个 foreach activity 连接到查找 activity
在设置下它的值为:
@activity('LookupMessageType').output.value
我有另一个副本 activity,其中 运行 在此 foreach activity 中。它将数据从 cosmos DB 复制到 Azure Data Lake。
这是源数据集中的查询:
select c.Tag, data.assetTag, data.timestamp, data.jsonVersion, data.messageType, data.speed from c join data in c.data
where (data.speed> item().speed_Value) AND
(data.timestamp >= '@{formatDateTime(addhours(pipeline().TriggerTime, -1), 'yyyy-MM-ddTHH:mm:ssZ' )}'
AND data.timestamp < '@{formatDateTime(pipeline().TriggerTime, 'yyyy-MM-ddTHH:mm:ssZ' )}')
我在 运行 此管道时遇到错误:
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorDocumentDBReadError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=DocumentDb operation failed: Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: *redacted*, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0.,Source=Microsoft.DataTransfer.ClientLibrary.DocumentDb,''Type=Microsoft.Azure.Documents.BadRequestException,Message=Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: redacted, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0,Source=Microsoft.Azure.Documents.Client,''Type=System.Runtime.InteropServices.COMException,Message=Exception from HRESULT: 0x800A0B00,Source=,'",
"failureType": "UserError",
"target": "Copy Data1"
}
它说 item 不是内置函数名。我想使用 foreach activity 中的值来查询源。
此外,这是我的动态文件路径内容
@concat('test_', item().speed, '.csv')
我用这个表达式得到了想要的动态文件结构,如果我在查询中使用静态值,比如:data.speed> 500
所以,我弄清楚查询出了什么问题:
而不是
where (data.speed> item().speed_Value)
我不得不使用
where (data.speed> @{item().speed_value})
我有一个查找 activity 从 blob 中的容器获取值。我有一个 foreach activity 连接到查找 activity
在设置下它的值为:
@activity('LookupMessageType').output.value
我有另一个副本 activity,其中 运行 在此 foreach activity 中。它将数据从 cosmos DB 复制到 Azure Data Lake。
这是源数据集中的查询:
select c.Tag, data.assetTag, data.timestamp, data.jsonVersion, data.messageType, data.speed from c join data in c.data
where (data.speed> item().speed_Value) AND
(data.timestamp >= '@{formatDateTime(addhours(pipeline().TriggerTime, -1), 'yyyy-MM-ddTHH:mm:ssZ' )}'
AND data.timestamp < '@{formatDateTime(pipeline().TriggerTime, 'yyyy-MM-ddTHH:mm:ssZ' )}')
我在 运行 此管道时遇到错误:
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorDocumentDBReadError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=DocumentDb operation failed: Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: *redacted*, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0.,Source=Microsoft.DataTransfer.ClientLibrary.DocumentDb,''Type=Microsoft.Azure.Documents.BadRequestException,Message=Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":231,\"end\":235},\"code\":\"SC2005\",\"message\":\"'item' is not a recognized built-in function name.\"}]}\r\nActivityId: redacted, documentdb-dotnet-sdk/1.21.1 Host/64-bit MicrosoftWindowsNT/6.2.9200.0,Source=Microsoft.Azure.Documents.Client,''Type=System.Runtime.InteropServices.COMException,Message=Exception from HRESULT: 0x800A0B00,Source=,'",
"failureType": "UserError",
"target": "Copy Data1"
}
它说 item 不是内置函数名。我想使用 foreach activity 中的值来查询源。
此外,这是我的动态文件路径内容
@concat('test_', item().speed, '.csv')
我用这个表达式得到了想要的动态文件结构,如果我在查询中使用静态值,比如:data.speed> 500
所以,我弄清楚查询出了什么问题: 而不是
where (data.speed> item().speed_Value)
我不得不使用
where (data.speed> @{item().speed_value})