NULL 从管道传递到链接的服务 baseURL

时间:2021-04-04 15:48:14

标签: azure-data-factory azure-data-factory-2 azure-data-factory-pipeline

我有一个管道,可以遍历文件并将它们复制到存储位置。

baseURL 和 relativeURL 存储在一个 json 文件中。

我可以读入这个文件并且它是有效的。

我已经参数化了链接服务的 baseURL,这在从链接服务和数据集进行测试时有效。

然而,当我尝试调试管道时,出现错误:

<块引用>

"code":"BadRequest"
“消息”:空
"目标":"管道//runid/310b8ac1-2ce6-4c7c-a1ad-433ee9019e9b"
"详细信息":null
“错误”:空

从管道中的活动看来,传递的是空值而不是 baseURL。

我已经迭代了我的配置文件中的值,它正在被读取并且值是正确的。管道似乎没有为 baseURL 传递正确的值。

我是否必须修改管道背后的 json 代码才能使其工作?

如果有帮助,链接服务、数据集和管道的 json 如下:

--链接服务:

{
"name": "ls_http_opendata_ecdc_europe_eu",
"properties": {
    "parameters": {
        "baseURL": {
            "type": "string"
        }
    },
    "annotations": [],
    "type": "HttpServer",
    "typeProperties": {
        "url": "@linkedService().baseURL",
        "enableServerCertificateValidation": true,
        "authenticationType": "Anonymous"
    }
}
}

--数据集

{
"name": "ds_ecdc_raw_csv_http",
"properties": {
    "linkedServiceName": {
        "referenceName": "ls_http_opendata_ecdc_europe_eu",
        "type": "LinkedServiceReference"
    },
    "parameters": {
        "relativeURL": {
            "type": "string"
        },
        "baseURL": {
            "type": "string"
        }
    },
    "annotations": [],
    "type": "DelimitedText",
    "typeProperties": {
        "location": {
            "type": "HttpServerLocation",
            "relativeUrl": {
                "value": "@dataset().relativeURL",
                "type": "Expression"
            }
        },
        "columnDelimiter": ",",
        "escapeChar": "\\",
        "firstRowAsHeader": true,
        "quoteChar": "\""
    },
    "schema": []
}
}

--管道

{
"name": "pl_ingest_ecdc_data",
"properties": {
    "activities": [
        {
            "name": "lookup ecdc filelist",
            "type": "Lookup",
            "dependsOn": [],
            "policy": {
                "timeout": "7.00:00:00",
                "retry": 0,
                "retryIntervalInSeconds": 30,
                "secureOutput": false,
                "secureInput": false
            },
            "userProperties": [],
            "typeProperties": {
                "source": {
                    "type": "JsonSource",
                    "storeSettings": {
                        "type": "AzureBlobStorageReadSettings",
                        "recursive": true,
                        "enablePartitionDiscovery": false
                    },
                    "formatSettings": {
                        "type": "JsonReadSettings"
                    }
                },
                "dataset": {
                    "referenceName": "ds_ecdc_file_list",
                    "type": "DatasetReference"
                },
                "firstRowOnly": false
            }
        },
        {
            "name": "execute copy for every record",
            "type": "ForEach",
            "dependsOn": [
                {
                    "activity": "lookup ecdc filelist",
                    "dependencyConditions": [
                        "Succeeded"
                    ]
                }
            ],
            "userProperties": [],
            "typeProperties": {
                "items": {
                    "value": "@activity('lookup ecdc filelist').output.value",
                    "type": "Expression"
                },
                "activities": [
                    {
                        "name": "Copy data1",
                        "type": "Copy",
                        "dependsOn": [],
                        "policy": {
                            "timeout": "7.00:00:00",
                            "retry": 0,
                            "retryIntervalInSeconds": 30,
                            "secureOutput": false,
                            "secureInput": false
                        },
                        "userProperties": [],
                        "typeProperties": {
                            "source": {
                                "type": "DelimitedTextSource",
                                "storeSettings": {
                                    "type": "HttpReadSettings",
                                    "requestMethod": "GET"
                                },
                                "formatSettings": {
                                    "type": "DelimitedTextReadSettings"
                                }
                            },
                            "sink": {
                                "type": "DelimitedTextSink",
                                "storeSettings": {
                                    "type": "AzureBlobFSWriteSettings"
                                },
                                "formatSettings": {
                                    "type": "DelimitedTextWriteSettings",
                                    "quoteAllText": true,
                                    "fileExtension": ".txt"
                                }
                            },
                            "enableStaging": false,
                            "translator": {
                                "type": "TabularTranslator",
                                "typeConversion": true,
                                "typeConversionSettings": {
                                    "allowDataTruncation": true,
                                    "treatBooleanAsNumber": false
                                }
                            }
                        },
                        "inputs": [
                            {
                                "referenceName": "DelimitedText1",
                                "type": "DatasetReference",
                                "parameters": {
                                    "sourceBaseURL": {
                                        "value": "@item().sourceBaseURL",
                                        "type": "Expression"
                                    },
                                    "sourceRelativeURL": {
                                        "value": "@item().sourceRelativeURL",
                                        "type": "Expression"
                                    }
                                }
                            }
                        ],
                        "outputs": [
                            {
                                "referenceName": "ds_ecdc_raw_csv_dl",
                                "type": "DatasetReference",
                                "parameters": {
                                    "fileName": {
                                        "value": "@item().sinkFileName",
                                        "type": "Expression"
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
        }
    ],
    "concurrency": 1,
    "annotations": []
}
}

1 个答案:

答案 0 :(得分:0)

我重现了您的错误。

{"code":"BadRequest","message":null,"target":"pipeline//runid/abd35329-3625-490b-85cf-f6d0de3dac86","details":null,"error":null}

这是因为您没有将 baseURL 传递给源数据集中的链接服务。请这样做:

enter image description here

Dataset JSON 代码应该是这样的:

{
    "name": "ds_ecdc_raw_csv_http",
    "properties": {
        "linkedServiceName": {
            "referenceName": "ls_http_opendata_ecdc_europe_eu",
            "type": "LinkedServiceReference",
            "parameters": {
                "baseURL": {
                    "value": "@dataset().baseURL",
                    "type": "Expression"
                }
            }
        },
        "parameters": {
            "relativeURL": {
                "type": "string"
            },
            "baseURL": {
                "type": "string"
            }
        },
        "annotations": [],
        "type": "DelimitedText",
        "typeProperties": {
            "location": {
                "type": "HttpServerLocation",
                "relativeUrl": {
                    "value": "@dataset().relativeURL",
                    "type": "Expression"
                }
            },
            "columnDelimiter": ",",
            "escapeChar": "\\",
            "firstRowAsHeader": true,
            "quoteChar": "\""
        },
        "schema": []
    }
}