我目前有一个V2数据工厂,它将带有物料清单的UTF8编码文件复制到存储位置,我想将物料清单作为标准复制活动的一部分删除。
有没有办法做到这一点?
发布于 2018-08-09 23:36:57
事实证明,这实际上很容易做到。在输出数据集中,如果我们不指定编码数据,那么工厂将默认使用UTF-8,而不添加BOM。以下数据集说明了这一原则:
这是我的输入数据集:
{ "name": "InputBlobs", "properties": { "linkedServiceName": { "referenceName": "AzureStorageLinkedService", "type": "LinkedServiceReference" }, "type": "AzureBlob", "typeProperties": { "format": { "type": "TextFormat", "columnDelimiter": "|", "rowDelimiter": "", "nullValue": "\\N", "encodingName": "UTF-16", "treatEmptyAsNull": true, "skipLineCount": 0, "firstRowAsHeader": false }, "fileName": "", "folderPath": "folder_path" } }, "type": "Microsoft.DataFactory/factories/datasets" }
以下是我的输出数据集:
{ "name": "OutputBlobs", "properties": { "linkedServiceName": { "referenceName": "AzureStorageLinkedService", "type": "LinkedServiceReference" }, "type": "AzureBlob", "typeProperties": { "format": { "type": "TextFormat", "columnDelimiter": "|", "rowDelimiter": "", "nullValue": "\\N", "treatEmptyAsNull": true, "skipLineCount": 0, "firstRowAsHeader": false }, "fileName": "", "folderPath": "another_folder_path" } }, "type": "Microsoft.DataFactory/factories/datasets" }
发布于 2018-08-07 16:29:04
根据我的经验,没有这样的中间件处理机制可以让您在Azure Data Factory Copy activity
中删除bom header
。
但是,我提供了一个变通方法,当文件移到blob存储中时,您可以使用Blob Trigger Azure Function来执行业务逻辑代码。
移除bom示例代码:
public static string RemoveBom(String desc, Encoding encode)
{
string bomString = encode.GetString(encode.GetPreamble());
if (!string.IsNullOrEmpty(bomString) && desc.StartsWith(bomString))
{
desc = desc.Remove(0, bomString.Length);
}
return desc;
}
希望能对你有所帮助。
https://stackoverflow.com/questions/51671622
复制相似问题