【问题标题】:azure data factory get lookup activity error output天蓝色数据工厂获取查找活动错误输出
【发布时间】:2020-07-15 08:21:26
【问题描述】:

我的管道,当查找失败时,只有一个查找活动和一个存储过程活动。

查找发送类似

的查询
    select 1/count(*) as result from sometable

存储过程活动使用名为“错误”的参数调用存储过程。

基本上我希望当 count(*) 为 0 时此查找失败,然后我想从活动输出中捕获除以 0 错误消息并将其用作存储过程的输入参数。

count(*) 为 0 时查找的输出为:

    {
        "errorCode": "2100",
        "message": "Failure happened on 'Sink' side. ErrorCode=UserErrorFailedFileOperation,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Upload file failed at path 37b1ec96-be95-4010-8547-10387fc407a3\\result.,Source=Microsoft.DataTransfer.Common,''Type=System.Data.SqlClient.SqlException,Message=Divide by zero error encountered.,Source=.Net SqlClient Data Provider,SqlErrorNumber=8134,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=8134,State=1,Message=Divide by zero error encountered.,},],'",
        "failureType": "UserError",
        "target": "Lookup source count",
        "details": []
    }

所以在存储过程活动中,我想把上面的消息放到存储过程的参数中。我已经尝试 @activity('Lookup source count').output.message 作为输入参数。但是得到这个错误:

    {
        "errorCode": "InvalidTemplate",
        "message": "The expression 'activity('Lookup source count').output.message' cannot be evaluated because property 'message' doesn't exist, available properties are ''.",
        "failureType": "UserError",
        "target": "log fail Lookup source count",
        "details": ""
    }

我也尝试了许多其他选项,但没有一个有效。查找失败时如何从查找中获取错误消息?

【问题讨论】:

    标签: azure-data-factory azure-data-factory-2


    【解决方案1】:

    使用“添加动态内容”,将其用作您的 SP 参数值

    @activity('<name of your lookup>').Error.Message

    【讨论】:

    • 有这方面的文件吗?我用谷歌搜索了很多,但找不到任何关于此的内容。
    • 我想我是通过谷歌搜索找到的,但你是 100% 正确的,有很多魔法咒语没有被谷歌搜索。另一种方法是检查监视器中的输出,您可以看到输出 json 是那种形式
    • 这当然是表达式语法的指南,但没有关于如何捕获活动输出的线索。
    • 这里还有一堆方便的参考资料。 mssqltips.com/sqlservertip/6320/… 我在尝试找出为什么在复制活动失败后@activity('<copy activity>').output 为空时发现了这一点。错误消息很容易捕获。
    • 这个social.msdn.microsoft.com/Forums/azure/en-US/… 错误地指出@{activity('Copy 1').output.errors} 应该捕获错误 - 它没有。或者也许确实如此,他们改变了它
    猜你喜欢
    • 2020-05-25
    • 2017-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-17
    • 2022-11-11
    • 2020-12-22
    相关资源
    最近更新 更多