Saturday, May 26, 2012

Guidelines for Knowledge Module Developers

Guidelines for Knowledge Module Developers

The first guidelines when developing your own KM is to never start from a blank page.
Oracle Data Integrator provides a large number of knowledge modules out-of-the-box. It is recommended that you start by reviewing the existing KMs and start from an existing KM that is close to your use case. Duplicate this KM and customize it by editing the code.
When developing your own KM, keep in mind that it is targeted to a particular stage of the integration process. As a reminder:
  • LKMs are designed to load remote source data sets to the staging area into Loading ("C$") tables.
  • IKMs apply the source flow from the staging area to the target. They start from the Loading tables, may transform and join them into a single integration table ("I$") table, may call a CKM to perform data quality checks on this integration table, and finally write the flow data to the target
  • CKMs check data quality in a datastore or a integration table ("I$") against data quality rules expressed as constraints. The rejected records are stored in the error table ("E$")
  • RKMs are in charge of extracting metadata from a metadata provider to the Oracle Data Integrator repository by using the SNP_REV_xx temporary tables.
  • JKMs are in charge of creating and managing the Change Data Capture infrastructure.
Be also aware of these common pitfalls:
  • 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.

No comments:

Post a Comment