gpt4 book ai didi

Azure 数据工厂导入 : many to many relationship

转载 作者:行者123 更新时间:2023-12-03 02:00:03 25 4
gpt4 key购买 nike

我正在尝试使用 Azure 数据工厂将 .csv 文件导入 Microsoft SQLServer 数据库。 .csv 文件头如下所示

VehicleVIN, VehicleMake, VehicleModel, CustomerName, CustomerAddress

我已将 VehicleVINVehicleMakeVehicleModel 放入 VehicleTable 中。我已将 CustomerRefCustomerNameCustomerAddress 放入 CustomerTable 中。

由于这是这两个实体之间的多对多关系,因此我需要添加第三个名为 VehicleCustomerTable (Id, VehicleId , CustomerId),我应该在其中保存已放入 VehicleTableCustomerTable 中的实体的 id。

问题是我不知道如何将它们关联到同一数据流中。我是否需要另一个数据流来处理这个数据流?如果需要单独的数据流,我如何知道哪个客户属于哪个车辆?我已经构建了一个数据流,将数据下沉到相应的表中,但问题是这两个实体的关联。

Azure Data Flow

最佳答案

下面是输入数据。

enter image description here

在这里,我使用 surrogatekey 添加了新列 CustomerRef,因为您没有在输入中给出。如果列中有 customerid,请使用 customerid

接下来,我通过在 VehicleVINCustomerRef 上使用 Aggregate 组件完成了分组。然后对于聚合,我只是使用 tmp 作为列,使用 max(CustomerRef) 作为值,后来我在选择组件中取消选择此列。这样做只是为了避免错误。

以下是设置。

分组依据

enter image description here

聚合下 enter image description here

接下来,添加 surrogatekey 组件来创建 Id 列。

设置: enter image description here

预览:

enter image description here

然后使用 select 组件取消选择 tmp 列,如下所示。

enter image description here

您将获得最终数据预览。

enter image description here

最后将此数据接收到名为 VehicleCustomerTable 的 SQL 表。

关于Azure 数据工厂导入 : many to many relationship,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76610977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com