私はtxtファイルを含む紺碧のブロブを持っています。一部の列には空の値が含まれているため、データベース テーブルに保存すると NULL になります。ダイレクト SQL および SSIS ETL パッケージで動作させることができます。
行の例:
1002,100,Butter,whiped with salt BUTTER,WHIPPED W SALT,Y,0,6.38,,,
最後の 3 つは null と見なされます。
ADF を使用しようとすると、次のエラーが表示されます。
コピー アクティビティでユーザー エラーが発生しました。' ' を 'Decimal' 型に変換できません。,Source=Microsoft.DataTransfer.Common,''Type=System.FormatException,Message=入力文字列の形式が正しくありません.,Source=mscorlib,'.
食べ物の説明アズールブロブ:
{
"name": "FoodDescriptionsAzureBlob",
"properties": {
"structure": [
{
"name": "NutrientDatabankNumber",
"type": "Int32"
},
{
"name": "FoodGroupCode",
"type": "Int32"
},
{
"name": "LongDescription",
"type": "String"
},
{
"name": "ShortDescription",
"type": "String"
},
{
"name": "CommonName",
"type": "String"
},
{
"name": "ManufacturerName",
"type": "String"
},
{
"name": "Survey",
"type": "String"
},
{
"name": "ReferenceDescription",
"type": "String"
},
{
"name": "RefusePercentage",
"type": "Int32"
},
{
"name": "ScientificName",
"type": "String"
},
{
"name": "NitrogenFactor",
"type": "Decimal"
},
{
"name": "ProteinFactor",
"type": "Decimal"
},
{
"name": "FatFactor",
"type": "Decimal"
},
{
"name": "CarbohydratesFactor",
"type": "Decimal"
}
],
"published": false,
"type": "AzureBlob",
"linkedServiceName": "AzureStorageLinkedService",
"typeProperties": {
"fileName": "FOOD_DES.txt",
"folderPath": "gym-nutrition-data/NutrientData/",
"format": {
"type": "TextFormat",
"rowDelimiter": "\n",
"columnDelimiter": "^",
"nullValue": "",
"quoteChar": "~"
}
},
"availability": {
"frequency": "Minute",
"interval": 15
},
"external": true,
"policy": {}
}
}
FoodDescriptionsSQLAzure:
{
"name": "FoodDescriptionsSQLAzure",
"properties": {
"structure": [
{
"name": "NutrientDatabankNumber",
"type": "Int32"
},
{
"name": "FoodGroupCode",
"type": "Int32"
},
{
"name": "LongDescription",
"type": "String"
},
{
"name": "ShortDescription",
"type": "String"
},
{
"name": "CommonName",
"type": "String"
},
{
"name": "ManufacturerName",
"type": "String"
},
{
"name": "Survey",
"type": "String"
},
{
"name": "ReferenceDescription",
"type": "String"
},
{
"name": "RefusePercentage",
"type": "Int32"
},
{
"name": "ScientificName",
"type": "String"
},
{
"name": "NitrogenFactor",
"type": "Decimal"
},
{
"name": "ProteinFactor",
"type": "Decimal"
},
{
"name": "FatFactor",
"type": "Decimal"
},
{
"name": "CarbohydratesFactor",
"type": "Decimal"
}
],
"published": false,
"type": "AzureSqlTable",
"linkedServiceName": "AzureSqlLinkedService",
"typeProperties": {
"tableName": "FoodDescriptions"
},
"availability": {
"frequency": "Minute",
"interval": 15
}
}
}
パイプライン:
{
"name": "NutrientDataBlobToAzureSqlPipeline",
"properties": {
"description": "Copy nutrient data from Azure BLOB to Azure SQL",
"activities": [
{
"type": "Copy",
"typeProperties": {
"source": {
"type": "BlobSource",
"treatEmptyAsNull": true
},
"sink": {
"type": "SqlSink",
"writeBatchSize": 10000,
"writeBatchTimeout": "60.00:00:00"
}
},
"inputs": [
{
"name": "FoodGroupDescriptionsAzureBlob"
}
],
"outputs": [
{
"name": "FoodGroupDescriptionsSQLAzure"
}
],
"policy": {
"timeout": "01:00:00",
"concurrency": 1,
"executionPriorityOrder": "NewestFirst"
},
"scheduler": {
"frequency": "Minute",
"interval": 15
},
"name": "FoodGroupDescriptions",
"description": "#1 Bulk Import FoodGroupDescriptions"
},
{
"type": "Copy",
"typeProperties": {
"source": {
"type": "BlobSource",
"treatEmptyAsNull": true
},
"sink": {
"type": "SqlSink",
"writeBatchSize": 10000,
"writeBatchTimeout": "60.00:00:00"
}
},
"inputs": [
{
"name": "FoodDescriptionsAzureBlob"
}
],
"outputs": [
{
"name": "FoodDescriptionsSQLAzure"
}
],
"policy": {
"timeout": "01:00:00",
"concurrency": 1,
"executionPriorityOrder": "NewestFirst"
},
"scheduler": {
"frequency": "Minute",
"interval": 15
},
"name": "FoodDescriptions",
"description": "#2 Bulk Import FoodDescriptions"
}
],
"start": "2015-07-14T00:00:00Z",
"end": "2015-07-14T00:00:00Z",
"isPaused": false,
"hubName": "gymappdatafactory_hub",
"pipelineMode": "Scheduled"
}
}
パイプラインで "treatEmptyAsNull": true を設定しようとしましたが、うまくいきませんでした。