Below is the example of using the SetEtl operation for adding a repository data provider 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 information about the created object and the list of its fields that is filled based on the table structure used as a data source.
{
"SetEtl" :
{
"tEtl" :
{
"id" : "S1!M!S!L1"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"objects" : "Add",
"object" :
{
"settings" : "true",
"provider" :
{
"props" : "true"
}
}
},
"meta" :
{
"objects" :
{
"its" :
{
"it" :
[
{
"k" : "0",
"id" : "REPO_PROVIDER",
"vis" : "true",
"type" : "PlainDataMetabaseProvider",
"settings" :
{
"plainProvider" :
{
"provider" :
{
"props" :
{
"type" : "Mb",
"mb" :
{
"dataset" :
{
"i" : "T_INDICATOR",
"n" : "Table",
"k" : "7013",
"c" : "769"
}
}
}
},
"fillFields" : "FromSource"
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"objects" : "Get",
"objectsFilter" :
{
"range" :
{
"start" : "3",
"count" : "1"
}
},
"object" :
{
"settings" : "true",
"provider" :
{
"fields" : "true"
},
"fields" : "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" : "3",
"id" : "REPO_PROVIDER",
"n" : "Repository provider1",
"vis" : "1",
"type" : "PlainDataMetabaseProvider",
"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" :
{
"plainProvider" :
{
"provider" :
{
"fields" :
{
"its" :
{
"it" :
[
{
"k" : "1",
"id" : "FKEY",
"n" : "FKey",
"vis" : "1",
"dt" : "2",
"dd" : "0",
"size" : "10",
"precision" : "0",
"expression" : "",
"calculated" : "0",
"dateFormat" : "DMY"
},
{
"k" : "2",
"id" : "FNAME",
"n" : "FName",
"vis" : "1",
"dt" : "1",
"dd" : "0",
"size" : "255",
"precision" : "0",
"expression" : "",
"calculated" : "0",
"dateFormat" : "DMY"
},
{
"k" : "3",
"id" : "ORD",
"n" : "Ord",
"vis" : "1",
"dt" : "2",
"dd" : "0",
"size" : "10",
"precision" : "0",
"expression" : "",
"calculated" : "0",
"dateFormat" : "DMY"
},
{
"k" : "4",
"id" : "FID",
"n" : "FId",
"vis" : "1",
"dt" : "1",
"dd" : "0",
"size" : "255",
"precision" : "0",
"expression" : "",
"calculated" : "0",
"dateFormat" : "DMY"
}
]
}
}
},
"fetchBlockSize" : "-1",
"ignoreIncorrectVals" : "0",
"unpivotMode" : "0"
}
}
}
]
}
},
"shapes" : ""
}
}
}
public static SetEtlResult AddProvider(MbId mb, EtlId moniker, string providerId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
var providerDesc = FindObjectById(mb, providerId); // Provider description
//Operation execution parameters
var tSet = new SetEtl()
{
tArg = new SetEtlArg()
{
pattern = new EtlMdPattern()
{
objects = ListOperation.Add,
@object = new EtlObjectPattern()
{
settings = true,
provider = new EtlProviderPattern()
{
props = true
}
}
},
meta = new EtlMd()
{
objects = new EtlObjects()
{
its = new EtlObject[]
{
new EtlObject()
{
//Basic properties
id = "REPO_PROVIDER",
k = 0,
type = EtlObjectType.PlainDataMetabaseProvider,
vis = true,
//Set up provider
settings = new EtlObjectSettings()
{
plainProvider = new EtlPlainDataProvider()
{
fillFields = EtlFillFieldsType.FromSource,
provider = new DtProviderMd()
{
props = new DtProviderProps()
{
type = DtProviderType.Mb,
mb = new DtProviderMb()
{
dataset = new Ob()
{
k = providerDesc.k,
i = providerDesc.i,
c = providerDesc.c,
n = providerDesc.n
}
}
}
}
}
}
}
}
}
},
metaGet = new EtlMdPattern()
{
objects = ListOperation.Get,
objectsFilter = new ListFilter() { range = new ListRange() {start = 3, count = 1}},
@object = new EtlObjectPattern()
{
fields = ListOperation.Get,
settings = true,
provider = new EtlProviderPattern() {fields = true}
}
}
},
tEtl = moniker
};
//Add object to ETL task
var result = somClient.SetEtl(tSet);
return result;
}
See also: