Below is the example of using the SetEtl operation for adding the Copy Data object to ETL task. The request contains moniker of opened ETL task instance and parameters of creating a new object: type of created object and its specific settings. The response contains updated information about ETL task objects.
{
"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" : "Table",
"k" : "37885",
"c" : "769",
"p" : "7011",
"h" : "false",
"hasPrv" : "false",
"ic" : "false"
}
},
"consumer" :
{
"obDesc" :
{
"@isShortcut" : "false",
"@isLink" : "false",
"@hf" : "false",
"i" : "BACKUP_DATA",
"n" : "Table",
"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 task for loading indicators",
"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" : "Import from Excel",
"vis" : "1",
"type" : "PlainDataExcelProviderEx",
"settings" :
{
"plainProvider" :
{
"provider" :
{
"props" :
{
"type" : "ExcelEx",
"excelEx" :
{
"stringDataFormat" :
{
"useSystem" : "1",
"dateFormat" : "DD.MM.YYYY",
"decimalSeparator" : ",",
"usePredefinedDateFormats" : "1"
},
"typeGuessRows" : "100",
"autoFillMode" : "DataRow",
"filterIf" : "",
"sheet" : "Sheet1",
"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" : "Repository consumer",
"vis" : "1",
"type" : "PlainDataMetabaseConsumer",
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "T_INDICATOR",
"n" : "Table",
"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" : "Table",
"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" : "Copy data",
"vis" : "1",
"type" : "PlainDataCopy",
"settings" :
{
"plainDataCopy" :
{
"provider" : "",
"consumer" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "T_INDICATOR",
"n" : "Table",
"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" : "Copy data1",
"vis" : "1",
"type" : "PlainDataCopy",
"settings" :
{
"plainDataCopy" :
{
"provider" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "DATA_INDICATORS",
"n" : "Table",
"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" : "Table",
"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(); //Proxy object for operation execution
//Operation execution parameters
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()
{
//Basic properties
id = "COPY_TABLE",
k = 0,
type = EtlObjectType.PlainDataCopy,
vis = true,
//Set up data copy object
settings = new EtlObjectSettings()
{
plainDataCopy = new EtlPlainDataCopy()
{
autoLink = true,
clearConsumer = true,
//Provider
provider = new DtProvider()
{
obDesc = FindObjectById(mb, "DATA_INDICATORS")
},
//Consumer
consumer = new DtConsumer()
{
obDesc = FindObjectById(mb, "BACKUP_DATA")
}
}
}
}
}
}
},
metaGet = new EtlMdPattern()
{
objects = ListOperation.Get
}
},
tEtl = moniker
};
//Add object to ETL task
var result = somClient.SetEtl(tSet);
return result;
}
See also: