Ниже приведен пример использования операции SetEtl для добавления в задачу ETL объекта «Копирование данных». В запросе передается моникёр открытого экземпляра задачи ETL и параметры создания нового объекта: тип создаваемого объекта и его специфические настройки. В ответе приходит обновленная информация об объектах задачи ETL.
{
"SetEtl" :
{
"tEtl" :
{
"id" : "S1!M!S!L1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"objects" : "Add",
"object" :
{
"settings" : "true"
}
},
"meta" :
{
"objects" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "COPY_TABLE",
"vis" : "true",
"type" : "PlainDataCopy",
"settings" :
{
"plainDataCopy" :
{
"provider" :
{
"obDesc" :
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "DATA_INDICATORS",
"n" : "Таблица",
"k" : "37885",
"c" : "769",
"p" : "7011",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
},
"consumer" :
{
"obDesc" :
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "BACKUP_DATA",
"n" : "Таблица",
"k" : "37886",
"c" : "769",
"p" : "7011",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
},
"autoLink" : "true",
"clearConsumer" : "true"
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"objects" : "Get"
}
}
}
}
{
"SetEtlResult" :
{
"id" :
{
"id" : "S1!M!S!L1"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "3",
"@hf" : "0",
"i" : "ETL_INDICATOR",
"n" : "Задача ETL для загрузки показателей",
"k" : "7012",
"c" : "4097",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "1",
"objects" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "PLAINDATAEXCELPROVIDEREX1",
"n" : "Импорт из Excel",
"vis" : "1",
"type" : "PlainDataExcelProviderEx",
"settings" :
{
"plainProvider" :
{
"provider" :
{
"props" :
{
"type" : "ExcelEx",
"excelEx" :
{
"stringDataFormat" :
{
"useSystem" : "1",
"dateFormat" : "ДД.ММ.ГГГГ",
"decimalSeparator" : ",",
"usePredefinedDateFormats" : "1"
},
"typeGuessRows" : "100",
"autoFillMode" : "DataRow",
"filterIf" : "",
"sheet" : "Лист1",
"hasHeader" : "1",
"headerRow" : "0",
"format" : "xlsx",
"dataRow" : "0"
},
"srcFileName" : "D:\Work\Indicator.xls"
}
},
"fetchBlockSize" : "-1",
"ignoreIncorrectVals" : "0",
"unpivotMode" : "0",
"queryForFile" : "0"
}
}
},
{
"k" : "1",
"id" : "PLAINDATAMETABASECONSUMER1",
"n" : "Приёмник репозитория",
"vis" : "1",
"type" : "PlainDataMetabaseConsumer",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "T_INDICATOR",
"n" : "Таблица",
"k" : "7013",
"c" : "769",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"read" : "1",
"write" : "1",
"settings" :
{
"plainConsumer" :
{
"consumer" :
{
"props" :
{
"type" : "Mb",
"mb" :
{
"dataset" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "T_INDICATOR",
"n" : "Таблица",
"k" : "7013",
"c" : "769",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
}
}
}
},
"keyFieldNames" : "",
"clearConsumer" : "1",
"bulk" :
{
"commitCount" : "1024",
"actionOnProblem" : "DiscardRecordsInTransaction",
"saveInvalidRecs" : "0",
"invalidRecsFileName" : "",
"useStopLimit" : "0",
"stopLimit" : "1024",
"eventId" : ""
}
}
}
},
{
"k" : "2",
"id" : "PLAINDATACOPY1",
"n" : "Копирование данных",
"vis" : "1",
"type" : "PlainDataCopy",
"settings" :
{
"plainDataCopy" :
{
"provider" : "",
"consumer" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "T_INDICATOR",
"n" : "Таблица",
"k" : "7013",
"c" : "769",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"keyFieldNames" : ""
},
"clearConsumer" : "1",
"commitCount" : "1024",
"actionOnProblem" : "DiscardRecordsInTransaction"
}
}
},
{
"k" : "3",
"id" : "COPY_TABLE",
"n" : "Копирование данных1",
"vis" : "1",
"type" : "PlainDataCopy",
"settings" :
{
"plainDataCopy" :
{
"provider" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "DATA_INDICATORS",
"n" : "Таблица",
"k" : "37885",
"c" : "769",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
}
},
"consumer" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "BACKUP_DATA",
"n" : "Таблица",
"k" : "37886",
"c" : "769",
"p" : "7011",
"h" : "0",
"hasPrv" : "0",
"ic" : "0"
},
"keyFieldNames" : ""
},
"clearConsumer" : "1",
"commitCount" : "1024",
"actionOnProblem" : "DiscardRecordsInTransaction"
}
}
}
]
}
},
"shapes" : ""
}
}
}
public static SetEtlResult AddETLObject(MbId mb, EtlId moniker)
{
var somClient = new SomPortTypeClient(); //Прокси-объект для выполнения операций
//Параметры выполнения операции
var tSet = new SetEtl()
{
tArg = new SetEtlArg()
{
pattern = new EtlMdPattern()
{
objects = ListOperation.Add,
@object = new EtlObjectPattern()
{
settings = true
}
},
meta = new EtlMd()
{
objects = new EtlObjects()
{
its = new EtlObject[]
{
new EtlObject()
{
//Базовые свойства
id = "COPY_TABLE",
k = 0,
type = EtlObjectType.PlainDataCopy,
vis = true,
//Настройка объекта копирования данных
settings = new EtlObjectSettings()
{
plainDataCopy = new EtlPlainDataCopy()
{
autoLink = true,
clearConsumer = true,
//Источник
provider = new DtProvider()
{
obDesc = FindObjectById(mb, "DATA_INDICATORS")
},
//Приемник
consumer = new DtConsumer()
{
obDesc = FindObjectById(mb, "BACKUP_DATA")
}
}
}
}
}
}
},
metaGet = new EtlMdPattern()
{
objects = ListOperation.Get
}
},
tEtl = moniker
};
//Добавление объекта в задачу ETL
var result = somClient.SetEtl(tSet);
return result;
}
См. также: