gpt4 book ai didi

带双引号的 Azure 数据工厂 CSV

转载 作者:行者123 更新时间:2023-12-03 13:54:12 34 4
gpt4 key购买 nike

我有一个检索 FTP 托管 CSV 文件的管道。它是用双引号标识符分隔的逗号。当字符串封装在双引号中,但字符串本身包含双引号时,存在此问题。

字符串示例:今年“Spring Sale”。

它在 csv 中的外观(后面有两个空列):

"","""Spring Sale"" this year",""

SSIS 可以很好地处理这个问题,但数据工厂希望将其转换为不以逗号分隔的额外列。我已经删除了这一行的额外引号,并且工作正常。

除了改变源代码之外,还有办法解决这个问题吗?

最佳答案

我通过 Azure 数据工厂复制任务将转义字符 设置为引号 (") 来实现此操作。屏幕截图:

ADF Copy Task

这是基于符合您规范的文件:

"","""今年 Spring 促销",""

也可以像插入 Azure SQL 数据库表一样工作。示例 JSON:

{
"name": "DelimitedText1",
"properties": {
"linkedServiceName": {
"referenceName": "linkedService2",
"type": "LinkedServiceReference"
},
"type": "DelimitedText",
"typeProperties": {
"location": {
"type": "AzureBlobStorageLocation",
"fileName": "quotes.txt",
"container": "someContainer"
},
"columnDelimiter": ",",
"escapeChar": "\"",
"quoteChar": "\""
},
"schema": [
{
"name": "Prop_0",
"type": "String"
},
{
"name": "Prop_1",
"type": "String"
},
{
"name": "Prop_2",
"type": "String"
}
]
}
}

也许示例文件太简单了,但它在这个配置中确实对我有用。

或者,只需使用 SSIS 并将其托管在数据工厂中。

关于带双引号的 Azure 数据工厂 CSV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56501708/

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