我应该使用Synapse,Databrick或ADF进行简单的数据转换吗?我问题的关键是我触发的工具是如何

问题描述 投票:0回答:1
i有一个数据湖,每个容器都由名为A,B,C等的文件夹组成。在每个文件夹中,我想将JSON文件合并到一个Parquet文件中,并带有一些简单的数据转换。因此,容器中的每个文件夹中有一个白斑文件。文件夹A的数据转换与文件夹B和C的数据转换不同,但是所有转换都会导致镶木材料文件。 随着时间的流逝,将使用相同的A,B,C文件夹结构和名称添加新容器,并且将更新JSON文件。 我正在考虑使用Synapse,Databricks和Azure Data Factory(ADF)执行此任务。但是,具有挑战性的部分是创建一个触发器,在需要时更新镶木quet文件。整个过程应自动化,数据转换工具监视数据湖并决定何时启动数据转换。

如何自动化此过程,以确保每当添加新数据或修改现有数据时更新镶木quet文件?任何有关设置触发器和自动化数据转换的指南将不胜感激。

也应该选择ADF和Azure功能吗?成本是我认为重要的:d

所有这些工具的新知识:d

如果您只有对ADF的限制,则可以使用两个管道,6个数据流和一个触发器尝试以下方法。

该设计涉及两种情况:

文件的满载:

首次应将文件合并为合并的镶木木材文件。
triggers azure-data-factory azure-databricks azure-synapse
1个回答
0
投票
遵循以下管道设计:

Get Meta Data Activity -> Take a Binary dataset without any container or file path and use Child items in the activity. For-Each activity -> Give the child items list to for-each activity and enable the Sequential checkbox. - Dataflow 1 -> Create a JSON dataset with dataset parameter in the container name and give it as source of the dataflow1. Pass the container name from the for loop to dataset parameter in the activity. Inside dataflow source settings give a wild card file path A/*.json and add your transformations after the source. In the sink give your parquet dataset. Use dataset parameters for the file name of the parquet if needed. - Dataflow 2 -> Similarly, do the same for folder B and add folder B transformations in the wild card file path, give B/*.json. - Dataflow 3 -> Similarly, do the same for folder C and add folder C transformations in the wild card file path, give C/*.json.

为增量负载:

在第一个负载后,使用以下管道设计。

为文件夹的创建参数和管道中的文件路径,并传递触发参数。现在,使用所有容器创建存储事件触发器,并将

.json

作为文件结束路径。

引用此
so答案

了解将触发参数传递给管道参数。 为增量负载创建另一组3个数据流。 获取带有容器的数据集参数的镶木quet数据集,并为您的文件夹提供一个镶木式文件名。将其用作source1和sink1。使用数据集参数创建另一个JSON数据集,用于容器和文件名。将此数据集用作数据流中的源2。使用联合转换

byName

对Source1和Source2都使用。添加与DataFlow中的接收器相同的Source1数据集。

然后遵循以下管道设计。

Set variable -> Extract the folder name and store it in a string variable `folder` using this expression from the pipeline parameter split(pipeline().parameters.folder_path,'/')[1]. Switch activity -> Give the `folder` variable to this - Case `A` -> Give the case name as `A`. - Dataflow A -> pass the folder name and file name parameters to the dataflow dataset parameters. - Case `B` -> Give the case name as `B`. - Dataflow B -> pass the folder name and file name parameters to the dataflow dataset parameters. - Case `C` -> Give the case name as `C`. - Dataflow C -> pass the folder name and file name parameters to the dataflow dataset parameters.

对于您的任何容器中的每个文件上传,上述管道都将提取其文件夹名称,并将文件数据附加到同一文件夹的parquet文件。

您已经提到转换很简单,因此,您可以尝试上述方法。

如果转换很复杂,那么使用数据映或用于转换的Synapse笔记本是更好的方法。您可以将ADF触发器用于文件上传/修改,并调用数据链钉或Synapse笔记本以传递文件路径。 enter image description here

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.