如何根据文件夹 F2 中是否存在其内容来复制文件夹 F1 中的 XML 文件(忽略文件名)

问题描述 投票:0回答:1

我们已经为我们运行的其他进程准备了一个 Azure 数据工厂,因此正在尝试使用它来解决以下问题:

我们已经拥有:

  • ADF 部署并运行,我们只需创建一个新的管道/数据流;
  • 链接服务访问所需文件夹(如在本地)。

我们目前没有但最终解决方案可能需要的:

  • 我们的资源组中的任何类型的存储,无论是数据库、Blob 存储等。但是,我们可以使用通过链接服务访问的 FS,因为容量不高,我们不会在管道之外使用数据本身。

用例:

  • 文件夹“F1”中放置有 XML 文件,这些文件是由连接到我们本地证券交易所的 FIX 服务的系统“生成并命名”的。 我们无法改变此过程中的任何内容 这是一个非常基本的过程,由于文件是由该系统命名的,没有考虑它们是什么,所以碰巧之前可能已经下载的交易会再次下载并给出另一个文件名,但文件的内容XML 文件是相同的;
  • 因此,我们需要一种方法来获取此类文件并将有关它的一些信息存储在我们稍后可以查找的地方,以查看是否需要将这个“新文件”发送给我们,或者忽略它,因为它是重复的。当前的“ETL”将由此处讨论的解决方案停用,它对每个文件的内容进行哈希处理,但这有点过分了,因为每个 XML 中至少有一个标签可以唯一地标识它(类似于 );
  • 最终,我们还需要压缩不重复的 XML 文件集合,通过将该 zip 放在文件夹“F2”中,将其发送到下游到另一个系统;
  • 每天我们都重新开始,无需查找昨天是否报告了今天的交易,因此我们可以在每天结束或开始时清除任何存储解决方案。
  • 我的情况是,从我读过的所有内容来看,我不确定所有这些都可以在 ADF 内完成,这意味着我到目前为止读过的所有案例都表明我至少必须部署 Azure Function 或 Logic Apps例如,提取和/或比较与“是否重复”评估相关的 XML 内容,这是可能的,但不可取(额外成本和批准此类解决方案的繁文缛节等),因此最好如果我们无需部署 ADF 以外的任何其他解决方案即可解决此问题。我也觉得奇怪,ADF 自己无法做到这一点。

至于存储解决方案,因为它只是关于流程本身,并且每天或在任何其他流程中都不会重复使用任何内容,所以我无法判断最好使用什么(DB?Blob?, FS 本身?),但如果它不会造成任何问题,我会坚持使用 FS。

我刚刚开始使用 Azure 产品,因此整体上很混乱,但我会做到的。

azure azure-data-factory etl
1个回答
0
投票

(Parent pipeline) - Get meta data 1 - child items - calculate your pipeline run interval timings and give the last modified- It selects only the files which are modified after given date. - Get meta data activity2 - get all child items. - foreach - give Get meta data activity1 child items. - Filter activity - Filter out current filename item().name from Get meta 2 child items array. - Execute pipeline activity(Child pipeline) - pass current filename and filter output array as parameters to child pipeline. (Child pipeline) - lookup activity1 - lookup to passed filename and get XML content as JSON array. - Set variable activity - create a boolean variable Flag with value set to false. - for-each - pass filter output array. - lookup activity2 - for getting current filename content. - set variable activity of int type - get length of intersection of lookup1 and lookup2 array with expression like @length(intersection(lookup1 array, lookup2 array)) - if activity - check this length greater than 1 or not - True activities - Set variable activity - Set the boolean variable Flag to true - if activity - check the Flag boolean true or not. - False activities - copy activity - copy the passed filename to temp folder - Copy activity - copy all files from temp folder to F2 folder as .zip file. Use Binary datsets for source and sink. Use wild card filepath in the source and `.zip(Deflate)` compression in the source dataset. - Delete activity - Delete all files in the `temp` folder using wild card file path. Use Binary dataset for this. - Delete activity - If you want to clean the old files in the F1 folder before next pipeline run, then delete all files in F1 folder as same as previous step.

在这里,您需要为 for 循环内使用的数据集或子管道中使用的数据集使用数据集参数。检查此
SO答案

以了解ADF管道中数据集参数的用法。 如果大小超过给定的行数,那么最好使用其他服务,例如函数或逻辑应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.