简体   繁体   English

将 CSV 数据复制到 JSON 数组 object 中的 Z3A580F142203677F153F0BC30898FZF 工厂数据

[英]Copying CSV data to a JSON array object in Azure Data Factory

I've been going round in circles trying to get what I thought would be a relatively trivial pipeline working in Azure Data Factory.我一直在兜圈子,试图得到我认为在 Azure 数据工厂中工作的相对微不足道的管道。 I have a CSV file with a schema like this:我有一个 CSV 文件,其架构如下:

Id, Name, Color
1, Apple, Green
2, Lemon, Yellow

I need to transform the CSV into a JSON file that looks like this:我需要将 CSV 转换为 JSON 文件,如下所示:

{"fruits":[{"Id":"1","Name":"Apple","Color":"Green"},{"Id":"2","Name":"Lemon","Color":"Yellow"}]

I can't find a simple example that helps me understand how to do this in ADF.我找不到一个简单的示例来帮助我理解如何在 ADF 中执行此操作。 I've tried a Copy activity, and a data flow, but the furthest I've got is a json object like this:我尝试了复制活动和数据流,但我得到的最远的是 json object,如下所示:

{"fruits":{"Id":"1","Name":"Apple","Color":"Green"}}
{"fruits":{"Id":"2","Name":"Lemon","Color":"Yellow"}}

Surely this is simple to achieve.当然,这很容易实现。 I'd be very grateful if anyone has any suggestions.如果有人有任何建议,我将不胜感激。 Thanks!谢谢!

https://docs.microsoft.com/en-us/azure/data-factory/copy-activity-schema-and-type-mapping#tabularhierarchical-source-to-hierarchical-sink https://docs.microsoft.com/en-us/azure/data-factory/copy-activity-schema-and-type-mapping#tabularhierarchical-source-to-hierarchical-sink

"When copying data from tabular source to hierarchical sink, writing to array inside object is not supported" “将数据从表格源复制到分层接收器时,不支持写入 object 内的数组”

But, if we put file pattern under Sink properties as 'Array of Objects', you can achieve somewhere till here:但是,如果我们将文件模式放在 Sink 属性下作为“对象数组”,您可以在此处实现:

    [{"Id":"1","Name":" Apple","Color":" Green"}
     ,{"Id":"2","Name":" Lemon","Color":" Yellow"}
    ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM