ODI Knowledge Module Developer's Guide
ODI Knowledge Module Developer's Guide
1-2 Oracle Fusion Middleware Knowledge Module Developer's Guide for Oracle Data Integrator
Check Knowledge Modules (CKM)
In STATIC_CONTROL mode, the CKM reads the constraints of the table and checks
them against the data of the table. Records that don't match the constraints are written
to the "E$" error table in the staging area.
In FLOW_CONTROL mode, the CKM reads the constraints of the target table of the
Mapping. It checks these constraints against the data contained in the "I$" flow table of
the staging area. Records that violate these constraints are written to the "E$" table of
the staging area.
In both cases, a CKM usually performs the following tasks:
1. Create the "E$" error table on the staging area. The error table should contain the
same columns as the attributes in the datastore as well as additional columns to
trace error messages, check origin, check date etc.
2. Isolate the erroneous records in the "E$" table for each primary key, alternate key,
foreign key, condition, mandatory column that needs to be checked.
3. If required, remove erroneous records from the table that has been checked.
1. The LKM creates the "C$" temporary table in the staging area. This table will hold
records loaded from the source server.
1-4 Oracle Fusion Middleware Knowledge Module Developer's Guide for Oracle Data Integrator
Integration Knowledge Modules (IKM)
2. The LKM obtains a set of pre-transformed records from the source server by
executing the appropriate transformations on the source. Usually, this is done by a
single SQL SELECT query when the source server is an RDBMS. When the source
doesn't have SQL capacities (such as flat files or applications), the LKM simply
reads the source data with the appropriate method (read file or execute API).
3. The LKM loads the records into the "C$" table of the staging area.
A mapping may require several LKMs when it uses datastores from different sources.
When all source datastores are on the same data server as the staging area, no LKM is
required.
When the staging area is on the target server, the IKM usually follows these steps:
1. The IKM executes a single set-oriented SELECT statement to carry out staging area
and target declarative rules on all "C$" tables and local tables (such as D in the
figure). This generates a result set.
2. Simple "append" IKMs directly write this result set into the target table. More
complex IKMs create an "I$" table to store this result set.
3. If the data flow needs to be checked against target constraints, the IKM calls a
CKM to isolate erroneous records and cleanse the "I$" table.
4. The IKM writes records from the "I$" table to the target following the defined
strategy (incremental update, slowly changing dimension, etc.).
5. The IKM drops the "I$" temporary table.
6. Optionally, the IKM can call the CKM again to check the consistency of the target
datastore.
These types of KMs do not manipulate data outside of the target server. Data
processing is set-oriented for maximum efficiency when performing jobs on large
volumes.
Figure 1–6 Integration Knowledge Module (Staging Area Different from Target)
When the staging area is different from the target server, as shown in Figure 1–6, the
IKM usually follows these steps:
1. The IKM executes a single set-oriented SELECT statement to carry out declarative
rules on all "C$" tables and tables located on the staging area (such as D in the
figure). This generates a result set.
2. The IKM loads this result set into the target datastore, following the defined
strategy (append or incremental update).
This architecture has certain limitations, such as:
■ A CKM cannot be used to perform a data integrity audit on the data being
processed.
■ Data needs to be extracted from the staging area before being loaded to the target,
which may lead to performance issues.
1-6 Oracle Fusion Middleware Knowledge Module Developer's Guide for Oracle Data Integrator
Guidelines for Knowledge Module Developers
■ Avoid creating too many KMs: A typical project requires less than 5 KMs! Do not
confuse KMs and procedures, and do not create one KM for each specific use case.
Similar KMs can be merged into a single one and parameterized using options.
■ Avoid hard-coded values, including catalog or schema names in KMs: You should
instead use the substitution methods getTable(), getTargetTable(),
getObjectName(), knowledge module options or others as appropriate.
■ Avoid using variables in KMs: You should instead use options or flex fields to
gather information from the designer.
■ Writing the KM entirely in Jython, Groovy or Java: You should do that if it is the
appropriate solution (for example, when sourcing from a technology that only has
a Java API). SQL is easier to read, maintain and debug than Java, Groovy or Jython
code.
■ Using <%if%> statements rather than a check box option to make code generation
conditional.
Other common code writing recommendations that apply to KMs:
■ The code should be correctly indented.
■ The generated code should also be indented in order to be readable.
■ SQL keywords such as "select", "insert", etc. should be in lowercase for better
readability.
1-8 Oracle Fusion Middleware Knowledge Module Developer's Guide for Oracle Data Integrator