代码之家  ›  专栏  ›  技术社区  ›  MAK

Azure数据工厂从foreach值获取数据

  •  4
  • MAK  · 技术社区  · 7 年前

    enter image description here

    在“设置”下,它的值为:

    @activity('LookupMessageType').output.value
    

    我有另一个复制活动,它在这个foreach活动中运行。它将数据从cosmos数据库复制到Azure数据湖。
    enter image description here

    这是源数据集中的查询:

    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活动的值来查询源代码。

    @concat('test_', item().speed, '.csv')
    

    如果在查询中使用静态值,则使用此表达式可以获得所需的动态文件结构,如: data.speed> 500

    1 回复  |  直到 7 年前
        1
  •  11
  •   MAK    7 年前

    所以,我找到了问题所在: 而不是

    where (data.speed> item().speed_Value)

    我不得不使用

    where (data.speed> @{item().speed_value})