azure - 当 ADF 中重新触发主管道时,如何仅处理每个事件中的失败文件

标签 azure azure-pipelines azure-data-factory

有两个管道主管道和子管道。 在子管道中有一个 foreach 事件,它将文件作为输入并并行处理它们。 例如有4个文件,其中2个文件已成功处理并将数据加载到表中。那么,第3个文件处理失败,第4个文件处理成功。现在,当我重新触发主管道时,我只想处理第三个文件,而不是所有 4 个文件。 我们怎样才能实现这一目标。

我已经尝试过以下。

To move/delete the file once the processing is completed

但根据要求,我不应该移动/删除该文件。有人可以帮忙吗?

最佳答案

我创建了一个测试并成功实现了这一目标。我的总体想法是:使用 Lookup 事件从 sql 表中提取复制的文件名数组,然后对源文件名数组执行 Filter 操作。如果该文件名已存在于sql表中,则不会执行文件复制事件。它需要我们通过附加列将文件名添加到复制事件中的sql表中。
enter image description here
在我的sql表中,它看起来如下:
enter image description here

  1. 我声明了 3 个变量。 arr1 数组类型变量存储源文件名。 filterArray 数组类型变量存储从sql表中复制的文件名数组。 enter image description here

  2. 在查找事件中,我们可以使用此查询select unique FileName from [dbo].[emp]从sql表中获取复制的文件名数组。 enter image description here

  3. 将值赋给变量filterArrayenter image description here

  4. 我将默认值["emp.csv","emp2.​​csv","emp3.csv","emp4.csv"]设置为变量的源文件名arr1enter image description here

  5. 在Foreah事件中,我们可以foreach变量arr1enter image description here

  6. 在 Foreach 事件内,将值 @item() 分配给变量 arrItementer image description here

  7. 然后进行Filter操作。项目:@variables('filterArr'),条件:@contains(item().FileName,variables('arrItem')),此 item() 这里代表 filterArray 数组中的每个元素。 enter image description here

  8. 在 If 条件事件中,使用 @empty(activity('Filter1').output.Value) 确定此文件是否已被复制。 enter image description here

  9. 在Ture事件中,键入动态内容@item(),这代表要复制的文件的名称。 enter image description here

仅此而已。

关于azure - 当 ADF 中重新触发主管道时,如何仅处理每个事件中的失败文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67982071/

相关文章:

azure - HDInsight - 资源部署失败

Azure函数服务总线触发器运行多次

python - 由于 ruamel.yaml 安装 azure-pipeline 时出现问题

azure - 如何使用不同的变量组在 Azure DevOps 管道中多次运行作业?

c++ - MacOS 上的 CTest 错误 : Test Executable not found

azure - 防止字段在数据工厂中更新

azure - 数据如何在 Azure 数据工厂中移动

c# - 当我从 Azure 更改 AD 中的密码时访问被拒绝

azure - 是否可以向 azure 数据工厂管道中的数据添加具有特定值的列

azure - 为什么 CNAME 记录在 Azure DNS 上返回 404 错误