带双引号的 Azure 数据工厂 CSV
Azure Data Factory CSV with double quotes
我有一个检索 FTP 托管 CSV 文件的管道。它是用逗号分隔的双引号标识符。存在字符串被双引号包裹,但字符串本身包含双引号的问题。
字符串示例:"Spring Sale" this year.
它在 csv 中的外观(后跟两个空列):
"","""Spring Sale"" this year",""
SSIS 可以很好地处理这个问题,但数据工厂希望将其转换为一个不以逗号分隔的额外列。我已经删除了这一行的多余引号,它工作正常。
除了更改源代码之外,还有其他解决方法吗?
我使用 Escape character
set as quote ("
) 和 Azure 数据工厂复制任务来实现它。屏幕截图:
根据您的规范,这是基于一个文件:
"","""Spring Sale"" this year",""
并且还在插入到 Azure SQL 数据库 table 中工作。样本 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 并将其托管在数据工厂中。
我有一个检索 FTP 托管 CSV 文件的管道。它是用逗号分隔的双引号标识符。存在字符串被双引号包裹,但字符串本身包含双引号的问题。
字符串示例:"Spring Sale" this year.
它在 csv 中的外观(后跟两个空列):
"","""Spring Sale"" this year",""
SSIS 可以很好地处理这个问题,但数据工厂希望将其转换为一个不以逗号分隔的额外列。我已经删除了这一行的多余引号,它工作正常。
除了更改源代码之外,还有其他解决方法吗?
我使用 Escape character
set as quote ("
) 和 Azure 数据工厂复制任务来实现它。屏幕截图:
根据您的规范,这是基于一个文件:
"","""Spring Sale"" this year",""
并且还在插入到 Azure SQL 数据库 table 中工作。样本 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 并将其托管在数据工厂中。