带双引号的 Azure 数据工厂 CSV

Dan*_*ter 8 azure double-quotes azure-data-factory azure-data-factory-2

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

字符串示例: "Spring Sale" this year.

它在 csv 中的外观(后跟和前导两个空列):

"","""Spring Sale"" this year",""
Run Code Online (Sandbox Code Playgroud)

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

除了更改源之外,还有其他方法可以解决此问题吗?

wBo*_*Bob 13

我在 Azure 数据工厂复制任务中使用Escape characterset as quote ( ") 使其工作。截屏:

ADF 复印任务

这是基于根据您的规范的文件:

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

并且还可以插入到 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"
            }
        ]
    }
}
Run Code Online (Sandbox Code Playgroud)

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

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

  • 这确实有效,并且正确支持 CSV RFC https://tools.ietf.org/html/rfc4180 Azure 数据工厂应该默认启用此功能为“而不是 \ (2认同)