[英]How do you handle an empty Rest call when trying to copy data in azure data factory?
I have a copy data activity in which my source dataset is set to a RestResource.我有一个复制数据活动,其中我的源数据集设置为 RestResource。 It works fine except for every once in a while the Rest call returns an empty dataset:
{"d":{"results":[]}}
它工作正常,除了偶尔 Rest 调用返回一个空数据集:
{"d":{"results":[]}}
This results in the following error这会导致以下错误
{
"errorCode": "2200",
"message": "ErrorCode=UserErrorTypeInSchemaTableNotSupported,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Failed to get the type from schema table. This could be caused by missing Sql Server System CLR Types.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.InvalidCastException,Message=Unable to cast object of type 'System.DBNull' to type 'System.Type'.,Source=Microsoft.DataTransfer.ClientLibrary,'",
"failureType": "UserError",
"target": "Import Punch Adjustments",
"details": []
}
I know for other sources you would want to do a lookup or check the metadata then do a conditional if, but I am unsure how to do that for a rest source.我知道对于其他来源,您可能想要查找或检查元数据然后执行条件 if,但我不确定如何为 rest 来源执行此操作。 Are there any other better options?
还有其他更好的选择吗?
You can add an activity on failure, this way even the copy activity fails pipeline will run successfully.您可以在失败时添加一个活动,这样即使复制活动失败管道也会成功运行。
Example:例子:
I have added an activity to store the error code on failure.我添加了一个活动来存储失败时的错误代码。
@string(activity('Copy data1').Error.errorCode)
Pipeline status:流水线状态:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.