Code Templates in OWB11gR2 Part 1 : Introduction and Support for Heterogeneous Databases
One of the new features introduced with Oracle Warehouse Builder 11gR2 is "Code Templates". This new feature allows you to develop mappings that use the "Knowledge Module" feature of Oracle Data Integrator (referred to in OWB11gR2 as "Code Templates") to create mappings that leverage Oracle and non-Oracle ETL functionality in addition to that provided by OWB. For example, you might use the code templates feature to extract, via a bulk extract utility, data from IBM DB/2, combine it with some data on a Teradata database, stage it through an Oracle database whilst maintaining some slowly changing dimensions, and then bulk load it into a data mart sitting on a Microsoft SQL Server database. So conceptually, how does this work?
In Oracle Data Integrator, knowledge modules are divided into a number of categories:
- Load knowledge modules, which confusingly are concerned with extracting data from sources
- Integration knowledge modules, which are used to integrate (or in other words, load) data into target databases
- Journalize knowledge modules, used for implementing native and trigger-based changed data capture
- Check knowledge modules, used for data checking and data quality
- Service knowledge modules, used for exposing mappings as web services, and
- Reverse knowledge modules, used when importing table definitions via reading database metadata
Oracle Warehouse Builder, as I'm sure readers of this blog would know, has up until now been Oracle-centric and has generally generated SQL and PL/SQL in order to move data around. Mappings in OWB contain both the logic of the transformation (the expressions, the column mappings and so on) and details of the technical implementation (whether to use MERGE, to use external tables and so on). Some of the more advanced functionality to use, for example, transportable tablespaces or data pump, has been accomplished by special types of database module that need to be executed outside of regular process flows. From OWB 10gR2, there has been some limited ability to extract from, and load in to, non-Oracle sources, but it's been tricky to set up and limited to Windows or Linux platforms (ODBC, through the Generic Connectivity feature in the Oracle database), or expensive (the various Gateway products that you can license for SQL Server, Teradata etc).
The 11gR2 release changes all of this by incorporating ODI's Knowledge Module framework into Warehouse Builder. It does this in several ways;
- You can now build mappings that make use of code templates to move data around
- ODI platform technology can be used to connect natively (via JDBC) to non-Oracle platforms (and Oracle, if you wish)
- ODI Journalize knowledge modules can be used to implement changed data capture on Oracle and non-Oracle sources
- ODI and traditional OWB functionality can be mixed and matched, allowing you to create mappings that use ODI knowledge modules together with OWB Oracle-specific functionality such as dimension loading, match-merge, multi-table inserts and so on
- You can write your own knowledge modules (or code templates, as they are called in OWB) to extend these capabilities to new platforms, new data extraction and loading approaches and so on, a bit like the way you can write Experts in previous releases of OWB.
In the Globals Navigator part of the main OWB application, as well as getting public transformations, public experts and so on, you now get public code templates. These are code templates (aka knowledge modules) that are certified to work in OWB and ship with the product. You need to have the ODI Enterprise Edition license to use these, but like the Enterprise ETL functionality in previous versions, there's nothing that warns you of this when you make use of them.
As well as the shipping public code templates, you can also import templates in from an ODI installation. In the screenshot below, I've imported all of the code templates in from ODI 10.1.3.5 so that I can subsequently work with Essbase, mySQL and other sources not supported "out of the box".
As I mentioned in my previous posting on OWB11gR2, another place that code templates pop up is in the new support for changed data capture. Taking my SQL Server module defined above, I can edit the module details, tell it which journalizing code template to use for CDC capture, pick my tables to monitor and then make use of changed data capture in my mappings.