Table of Contents

Search

  1. Preface
  2. Transformations
  3. Source transformation
  4. Target transformation
  5. Aggregator transformation
  6. Cleanse transformation
  7. Data Masking transformation
  8. Deduplicate transformation
  9. Expression transformation
  10. Filter transformation
  11. Hierarchy Builder transformation
  12. Hierarchy Parser transformation
  13. Hierarchy Processor transformation
  14. Input transformation
  15. Java transformation
  16. Java transformation API reference
  17. Joiner transformation
  18. Labeler transformation
  19. Lookup transformation
  20. Mapplet transformation
  21. Normalizer transformation
  22. Output transformation
  23. Parse transformation
  24. Python transformation
  25. Rank transformation
  26. Router transformation
  27. Rule Specification transformation
  28. Sequence Generator transformation
  29. Sorter transformation
  30. SQL transformation
  31. Structure Parser transformation
  32. Transaction Control transformation
  33. Union transformation
  34. Velocity transformation
  35. Verifier transformation
  36. Web Services transformation

Transformations

Transformations

Hierarchical to relational example

Hierarchical to relational example

You want to flatten hierarchical data and write the data to target files in relational and delimited formats.
A customer order file contains the current customer contact information and the recent orders for those customers. The order file is in hierarchical JSON format and is generated by your company's cloud application.
Using the order file data, you want to create a relational customers table to use for an update on the customer information in the master database. Separately, you want to analyze the orders that have been increasing. You can use the order file to create a separate delimited orders file for the analysis.
Use a Hierarchy Processor transformation in a mapping to transform the data from the hierarchical input to relational and delimited output.
To create and run the mapping, perform the following tasks:
  1. Ensure that you have access to an Amazon S3 V2 Connector for the S3 source and target objects.
  2. Add a Source transformation that reads hierarchical data from the source JSON file.
  3. Configure the following properties for the source object:
    Property
    Value
    Connection
    Amazon S3 V2
    Source Format
    JSON
  4. Add a Hierarchy Processor transformation.
    The following image shows the data flow:
    The mapping contains a Source transformation that is connected to a Hierarchy Processor transformation that is connected to two Target transformations.
  5. In the Hierarchy Processor transformation, create the
    OutputCustomers
    output group to create the relational customers data file.
    The following image shows how to add incoming fields, which will create the output group:
    The Hierarchy Processor tab contains a list of incoming fields on the left and output fields on the right. The Add Field dialog box is shown on the right.
  6. Create the
    OutputOrders
    output group to create the delimited orders data file.
  7. In the
    Hierarchy Processor
    tab, map
    Incoming Fields
    to
    Output Fields
    .
    You can add fields individually or use the following options for struct and array fields:
    • Add All Descendants. Adds all children under the field, including all arrays and structs. If the incoming field contains arrays, Data Integration creates a separate output group for each array.
    • Add Single Occurring Children. Adds all single occurring children under the field, even if the single occurring child is nested under a struct.
  8. Add a Target transformation to write the customers data output.
  9. Configure the following properties for the target object:
    Property
    Value
    Connection
    Amazon S3 V2
    Formatting Option
    Relational
  10. Add a Target transformation to write the orders data output.
  11. Configure the following properties for the target object:
    Property
    Value
    Connection
    Amazon S3 V2
    Formatting Option
    Delimited
  12. Link the
    OutputCustomers
    output group to the
    TargetCustomers
    Target transformation.
  13. Link the
    OutputOrders
    output group to the
    TargetOrders
    Target transformation.
  14. Run the mapping.