英文:
Azure Synapse Data flow, how to drop a field within an array
问题
希望删除数组中对象的字段在 synapse 数据流中。
示例数据:
"Animals":[{"name":"tiger","colour":"white","location":"zoo"},{"name":"eagle","colour":"brown","location":"wild"}]
预期输出:
"Animals":[{"name":"tiger","location":"zoo"},{"name":"eagle","location":"wild"}]
英文:
Looking to drop a field from an array of objects in synapse data flows.
Example data:
"Animals":[{"name":"tiger","colour":"white","location":"zoo"},{"name":"eagle","colour":"brown","location":"wild"}]
Expected Output:
"Animals":[{"name":"tiger","location":"zoo"},{"name":"eagle","location":"wild"}]
Looking for a way to drop the field. Thanks very much!
答案1
得分: 0
- 您可以使用数据流和复制活动来实现您的要求。我已经使用了以下配置的展平转换:
- 这将产生一些结果数据,我正在使用 sink 缓存将其写入数据流活动的输出。
- 在管道中,在数据流活动后面加入了一个复制数据活动,源文件如下(1 行和 1 列,无论如何都会被忽略)。
- 现在,按如下所示添加一个额外的列:
{"Animals":{@{activity('Data flow1').output.runStatus.output.sink1.Value}}}
- 现在,选择以分隔文件的形式的接收器文件,并使用以下配置:
- 在映射中,仅保留上面创建的额外列,并删除其余部分。
- 当您运行管道时,将按所需获取数据。您可以创建一个 JSON 数据集,并使用此文件作为 JSON 文件。
英文:
- You can use a dataflow and copy activity to achieve your requirement. I have used a flatten transformation with following configuration:
- This would give some resulting data which I am writing to dataflow activity output using sink cache.
- In the pipeline, I have taken a copy data activity after the dataflow activity with source file as follows (1 row and 1 column which will be ignored anyway).
- Now, add an additional column as shown below:
{"Animals":@{activity('Data flow1').output.runStatus.output.sink1.Value}}
- Now, choose sink file as delimited file with following configurations:
- In the mapping, keep only the above created additional column and delete the rest.
- When you run the pipeline, you would get the data as required. You can create a JSON dataset and use this file as a JSON file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论