Azure 数据工厂使用 XML 源复制数据

Azure Data Factory Copy Data using XML Source

假设我有一个简单的 XML 文件源,我已将其映射到 SQL 服务器数据库中的相应接收器。

<Date Date="2020-03-13Z">
    <Identification>
        <Identifier>Maverick</Identifier>
    </Identification>
    <Pilot HomeAirport="New York">
        <AirportICAOCode>USA</AirportICAOCode>
    </Pilot>
</Date>

然后是模式

CREATE TABLE pilots
identifier VARCHAR(20),
ICAO_code VARCHAR(3)
)

我在我的 sql 服务器数据库中创建了一个存储过程,它接受用户定义的 table 类型 pilots_type 的输入,该类型对应于上述模式以正确合并我的数据.

但是当 运行 时管道失败并出现错误:

{
"errorCode": "2200",
"message": "ErrorCode=UserErrorInvalidPluginType,'Type=Microsoft.DataTransfer.Common.Shared.PluginNotRegisteredException,Message=Invalid type 'XmlFormat' is provided in 'format'. Please correct the type in payload and retry.,Source=Microsoft.DataTransfer.ClientLibrary,'",
"failureType": "UserError",
"target": "Sink XML",
"details": []
}

见图
这里的源是一个包含 XML 的 blob。

XML毕竟不支持作为来源吗?

XML 支持作为来源。
我已经根据您的示例 xml 文件进行了相同的测试并且 sql table 成功。

  1. 我创建了一个名为 ct_pilot_type:
  2. 的 Table 类型
CREATE TYPE ct_pilot_type AS TABLE(
identifier  nvarchar(MAX),
ICAO_code nvarchar(MAX)
)
  1. 我创建了名为 spUpsertPolit:
  2. 的存储过程
CREATE PROCEDURE spUpsertPolit

@polit ct_pilot_type READONLY

AS

BEGIN

MERGE [dbo].[pilot_airports] AS target_sqldb

USING @polit AS source_tblstg

ON (target_sqldb.identifier = source_tblstg.identifier)

WHEN MATCHED THEN

UPDATE SET

identifier = source_tblstg.identifier,

ICAO_code = source_tblstg.ICAO_code


WHEN NOT MATCHED THEN

INSERT (

identifier,

ICAO_code

)

VALUES (

source_tblstg.identifier,

source_tblstg.ICAO_code

);

END
  1. 我在Copy中设置sinkactivity:

  1. 我设置映射:

  1. cpoied成功:

  2. 结果显示: