我正在将SQL Server Integration Services包移植到Azure数据工厂。将7列表复制到6列表
我有两个表(表1和表2),它们位于不同的服务器上。一个有七个专栏,另外六个专栏。我随后在https://docs.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,错误码= UserErrorInvalidColumnMappingColumnCountMismatch, '类型= Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,提供给复制活动消息=无效的列映射:' 区域名称: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列表中,Data Factory不喜欢它。我怎样才能完成这项任务?
你的意思是来自JSON的'structure'组件吗?目前尚不清楚。 – wBob