Defining New Attributes

1. Introduction to Defining New Attributes:

  • When designing mappings, you often need to create new attributes to facilitate the movement and transformation of data from source to target components.
  • Attributes are typically created to perform data transformations or adjustments within the mapping flow.

2. Methods for Defining New Attributes:

A. Using the Attribute Matching Dialog:

  • This dialog is triggered when dragging a connection from a connector port on one component to a connector port on another component, particularly when one component is a projector component.
  • Options in the dialog:
    • Create attributes on the target: If the target already has attributes with matching names, ODI will automatically map source attributes to the target attributes.
    • By Position option:
      • ODI will map attributes based on their position in the target. For example, if the target component already has 3 attributes and the source has 12, the first 3 attributes from the source will map to the first 3 target attributes, and the remaining 9 attributes will be added with their original names.

B. Dragging and Dropping Attributes:

  • Drag a single or multiple attributes from one component and drop them into another component:
    • Drop the attributes into a blank area of the component’s graphic (not on top of existing attributes).
    • If a connection doesn't already exist, ODI will create one, and the attribute will be created in the target component.
  • Tip:
    • If the component's graphic appears "full", hover over the attributes to reveal a scroll bar on the right side. Scroll to the bottom to expose a blank area where you can drag the new attributes.
  • Note:
    • If you drag an attribute onto an existing attribute, ODI will map it into the existing attribute, not creating a new attribute.

C. Adding New Attributes in the Property Inspector:

  • In the Property Inspector, go to the Attributes tab and click the green plus icon to create a new attribute.
  • Set the name, data type, and other properties for the new attribute in the Attributes table.
  • Once created, you can map to the new attribute by dragging attributes from other components onto it.
  • Caution:
    • Set the correct data type when creating a new attribute to prevent type-mismatch errors during execution. For example, if the attribute is a DATE type, make sure the new attribute is also set to DATE.
    • Type-mismatch errors will be flagged as SQL errors during execution.

D. Additional Notes:

  • ODI 12.2.1 onwards: When mapping a DB2 TIME column to a target column, only the time is displayed in the target column, and the date is omitted.

3. Tips and Warnings:

  • Data Type Validation: Always ensure the correct data type is set for any new attributes. Data mismatches, such as trying to map a DATE type to an INTEGER type, will result in execution errors.
  • Attribute Creation in the Property Inspector: While creating a new attribute through the property inspector, make sure you fill in the necessary properties, including name, data type, and other specifications, to avoid errors later on.
  • Efficient Mapping: Use attribute matching and drag-and-drop techniques to speed up mapping creation and avoid manual errors when defining attributes.

Summary:

  • Attributes are essential for data transformation and flow in ODI mappings.
  • You can define new attributes using various methods such as the Attribute Matching Dialog, drag-and-drop, or by directly adding them in the Property Inspector.
  • Be mindful of data type compatibility when creating attributes to avoid execution errors.

 

No comments:

Post a Comment