ODI 12c - Mapping Builder
By David Allan-Oracle on Apr 01, 2014
A few years ago I posted a utility (see interface builder post here) to build interfaces from driver files, here I have updated it for 12c to build mappings from driver files. The example uses a tab delimited text file to control the mapping creation, but it could be easily taken and changed to drive from whatever you wanted to capture the design of the mapping.
The mapping can be as complete or incomplete as you’d like, so could just contain the objects or could be concise and semantically complete.
The control file is VERY simple and just like ODI requests the minimal amount of information required. The basic format is as follows;So for example the control file below can define the sources, target, joins, mapping expressions etc;
|.....can add many|
|....can add many of the components above.|
So for example the control file below can define the sources, target, joins, mapping expressions etc;
- source SOURCE EMP EMP
- source SOURCE DEPT DEPT
- target TARGET_MODEL TGTEMP
- join EMP.DEPTNO = DEPT.DEPTNO AJOIN
- filter EMP.SAL > 1 EMP AFILTER
- lookup SOURCE BONUS EMP BONUS.ENAME = EMP.ENAME ALOOKUP
- mapping ENAME UPPER(EMP.ENAME)
- mapping DEPTNO ABS(DEPT.DEPTNO)
- mapping COMM ABS(BONUS.COMM)
When executed, this generates the mapping below with the join, filter, lookup and target expressions from the file;
You should be able to join the dots between the control file sample and the mapping design above. You will need to compile and execute the code in OdiMappingBuilder;
java –classpath <cp> OdinterfaceBuilder jdbc:oracle:thin:@localhost:1521:ora112 oracle.jdbc.OracleDriver ODI_MASTER mypwd WORKREP1 SUPERVISOR myodipwd DEMOS SDK DEMO1 < mymappingcontrolfile.tab
The mapping to be created is passed from the command line. You can intersperse other documentation lines between the control lines so long as the control keywords in first column don’t clash. See the driver file below viewed from within Excel;
Anyway some useful snippets of code for those learning the SDK (download OdiMappingBuilder here), or for those wanting to capture the design outside and generate ODI mappings. Have fun!