gpt4 book ai didi

azure-data-factory - 将 7 列表复制到 6 列表

转载 作者:行者123 更新时间:2023-12-01 13:32:15 25 4
gpt4 key购买 nike

我正在将 SQL Server Integration Services 包移植到 Azure 数据工厂。

我有两个位于不同服务器上的表(表 1 和表 2)。一个有七列,另一个有六列。我按照 https://learn.microsoft.com/en-us/azure/data-factory/data-factory-map-columns 中的示例进行操作

表 1 DDL:

CREATE TABLE dbo.Table1
(
zonename nvarchar(max),
propertyname nvarchar(max),
basePropertyid int,
dfp_ad_unit_id bigint,
MomentType nvarchar(200),
OperatingSystemName nvarchar(50)
)

表2 DDL

CREATE TABLE dbo.Table2
(
ZoneID int IDENTITY,
ZoneName nvarchar(max),
propertyName nvarchar(max),
BasePropertyID int,
dfp_ad_unit_id bigint,
MomentType nvarchar(200),
OperatingSystemName nvarchar(50)
)

在 ADF 中,我将表 1 定义为:

{
"$schema": "http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.Table.json",
"name": "Table1",
"properties": {
"type": "AzureSqlTable",
"linkedServiceName": "PlatformX",
"structure": [
{ "name": "zonename" },
{ "name": "propertyname" },
{ "name": "basePropertyid" },
{ "name": "dfp_ad_unit_id" },
{ "name": "MomentType" },
{ "name": "OperatingSystemName" }
],
"external": true,
"typeProperties": {
"tableName": "Platform.Zone"
},
"availability": {
"frequency": "Day",
"interval": 1
}
}
}

在 ADF 中,我将表 2 定义为:

{
"$schema": "http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.Table.json",
"name": "Table2",
"properties": {
"type": "SqlServerTable",
"linkedServiceName": "BrixDW",
"structure": [
{ "name": "ZoneID" },
{ "name": "ZoneName" },
{ "name": "propertyName" },
{ "name": "BasePropertyID" },
{ "name": "dfp_ad_unit_id" },
{ "name": "MomentType" },
{ "name": "OperatingSystemName" }
],
"external": true,
"typeProperties": {
"tableName": "staging.DimZone"
},
"availability": {
"frequency": "Day",
"interval": 1
}
}
}

如您所见,Table2 有一个标识列,该列将自动填充。

这应该是一个简单的复制事件:

{
"$schema": "http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.Pipeline.json",
"name": "Copy_Table1_to_Table2",
"properties": {
"description": "Copy_Table1_to_Table2",
"activities": [
{
"name": "Copy_Table1_to_Table2",
"type": "Copy",
"inputs": [
{ "name": "Table1" }
],
"outputs": [
{
"name": "Table2"
}
],
"typeProperties": {
"source": {
"type": "SqlSource",
"sqlReaderQuery": "select * from dbo.Table1"
},
"sink": {
"type": "SqlSink"
},
"translator": {
"type": "TabularTranslator",
"columnMappings": "zonename: ZoneName, propertyname: propertyName, basePropertyid: BasePropertyID, dfp_ad_unit_id: dfp_ad_unit_id, MomentType: MomentType, OperatingSystemName: OperatingSystemName"
}
},
"policy": {
"concurrency": 1,
"executionPriorityOrder": "OldestFirst",
"retry": 3,
"timeout": "01:00:00"
},
"scheduler": {
"frequency": "Day",
"interval": 1
}
}
],
"start": "2017-07-23T00:00:00Z",
"end": "2020-07-19T00:00:00Z"
}
}

我想通过不映射 ZoneID,它会被忽略。但是 ADF 给我以下错误。

复制事件遇到用户错误:GatewayNodeName=APP1250S,ErrorCode=UserErrorInvalidColumnMappingColumnCountMismatch,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=为复制事件提供的列映射无效:'zonename: ZoneName, propertyname: propertyName, basePropertyid:BasePropertyID,dfp_ad_unit_id:dfp_ad_unit_id,MomentType:MomentType,OperatingSystemName:OperatingSystemName',详细消息:目标结构和列映射之间的列计数不同。目标列数:7,列映射数:6。检查表定义中的列映射。,Source=Microsoft.DataTransfer.Common,'

简而言之,我正在尝试将 7 列表复制到 6 列表,但数据工厂不喜欢它。我怎样才能完成这个任务?

最佳答案

我意识到这是一个老问题,但我刚才遇到了这个问题。我的问题是我最初生成了目标/接收器表,创建了一个管道,然后添加了一列。

尽管清除并重新导入模式,但只要触发管道,它就会抛出上述错误。我确保在映射中取消选择新列(它有一个默认值),所以它只会使用默认值。错误仍然被抛出。

我设法使事情正常工作的唯一方法是从头开始完全重新创建管道。就好像在元数据的某个地方,旧的映射被保留了下来。

关于azure-data-factory - 将 7 列表复制到 6 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45304371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com