X

Welcome to All Things Data Integration: Announcements, Insights, Best Practices, Tips & Tricks, and Trend Related...

ODI 12c - Eclipse and Updated Mapping Builder Example

David Allan
Architect

The 12c ODI release offers a full SDK which allows great opportunities for automation. You can reduce development times and work smarter. Here I will show how to use Eclipse to configure and setup the the SDK to start working smarter. In this example I will use an updated version of Mapping Builder which is a sample SDK illustration I blogged about previously. The builder has been updated to include auto mapping of attributes, multiple targets, loading modes and more. The updated OdiMappingBuilder.java code used in this example is here

There is a viewlet illustrating the using Eclipse and the ODI SDK here. The viewlet walks through the entire configuration of an Eclipse project using the 12.1.3 release of ODI. 


The important areas are with respect to the libraries you need to define for the project, below you can see the libraries used from the ODI installation, I have installed my software in C:\Oracle\ODI_1213 in these examples.

Once the libraries are configured you can import the mapping builder java source code...

Then you must define how the code is executed, you specify the parameters as arguments. This is of course an example for illustration, you can define how you would like this to be done in whatever way you like. You specify all of the mapping builder parameters here. I also pass the control file as a parameter rather than via stdin (which is what I did in previous blog posts).

I mentioned the mapping builder code now supports auto mapping, multiple targets and loading mode, you can see an example driver file below. The line starting with >mapping has 2 qualifiers, below I have used EQUALS and IGNORECASE. The first parameter  supports the following values;

  • EQUALS - supports matching EMPNO with EMPNO (or empno with EMPNO when IGNORECASE used for example)
  • SRCENDSWITH - supports matching source XEMPNO with EMPNO (plus case option as above)
  • TGTENDSWITH - supports matching source EMPNO with XEMPNO (plus case option as above)

The second parameter supports;

  • MATCH - exact match, matches EMPNO with EMPNO or empno with empno
  • IGNORECASE - supports mismatched case matching EMPNO matches empno

As well as auto mapping you can also specify specific column level mapping explicitly as was previously supported, the viewlet has an example. 

 You can also see the control file has a target_load directive which can be given a condition or else in the final field, this let's you load multiple conditional based targets. This is a new addition to the existing target directive. So the example has 3 directives now;

  • target - load via insert/append the data
  • targetinc - incremental update / merge the data
  • target_load - insert multiple targets 

In the example above, the following mapping is created, you can see the multiple conditional based targets and data is mapped all from a simple driver file;

Using Eclipse you can quickly build and debug your utilities and applications using the SDK and get the benefits of using an IDE such as code insight and auto completion.

Check out the viewlet and the mapping builder example plus the blogs on the SDK such as the recent one on the SDK overview and work smarter. Also, the updated OdiMappingBuilder.java code used in this example is here - get an overview of the mapping builder here.

Join the discussion

Comments ( 7 )
  • Venkat Gali Friday, January 16, 2015

    Thanks David,

    Can you please answer following questions?

    1.Whats the advantage of using 'eclipse' over 'Groovy Editor' that comes with ODI Studio? I guess eclipse is for java developers where as Groovy Editor is for Groovy scripting

    2. If I have to learn one programming/scripting language to do everything possible in ODI 12C (development, automation, sysadmin etc), would that be Java or Groovy or Python or Jython?

    3. If it’s not possible to do everything with one language, can you let me know which language is good at what specific task (mapping automation, KM Development, run time automation etc) in ODI 12C?

    Thanks in advance


  • David Tuesday, January 20, 2015

    Hi Venkat

    1. In the Eclipse example I was using pure java, rather than Groovy in ODI. I would use the groovy editor in ODI for doing adhoc, scripting-like calls.

    2. The more you learn the better, you can take advantage of more. Java and groovy are very useful to know, you can get away with knowing a very thin layer of Python.

    3. With the SDK, knowing some Java / Groovy is useful. To work well building KM tasks a little java is useful - enough to do some loops and conditions with variables and the ODI substitution reference API. Jython and groovy are easy to pick up and allow you quickly to become productive in automating the mundane.

    Cheers

    David


  • guest Thursday, January 22, 2015

    Do IntelliJ next... do IntelliJ next... do IntelliJ next!


  • Ramunaidu Thursday, February 26, 2015

    Hi David,

    Here you passed the source and target tables through control file, but my question is how 2 pass the source and target tables through java code using odi sdk 12c.

    Thanks

    RamuNaidu


  • David Thursday, February 26, 2015

    Check the java code out which is linked inside the blog, it illustrates how to manipulate the map components;

    https://blogs.oracle.com/dataintegration/resource/odi12c_sdk/OdiMappingBuilder.java

    Cheers

    David


  • guest Thursday, December 31, 2015

    I'm want to implement a similar code but using reusable mapping, but I could find the way to add attributes into InputSignature/ OutputSignature components.

    Can you advice me how to do that

    Ragards,

    Cesar


  • David Monday, January 4, 2016

    Hi Cesar

    Should be able to create a component using the method createComponent (from the reusable mapping) and InputSignature.COMPONENT_TYPE_NAME and OutputSignature.COMPONENT_TYPE_NAME, see doc below;

    https://docs.oracle.com/middleware/1213/odi/reference-java-api/oracle/odi/domain/mapping/IMapComponentOwner.html#createComponent(java.lang.String, oracle.odi.domain.adapter.IModelObject)

    Then this has create attribute methods....

    Cheers

    David


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.