Create a Mapping Definition Manually

If creating the mapping manually, the source dataset is not required to be ingested first; however you need to know what the source fields are.

Before you begin

You need:

About this task

In this task, you will copy the mapping definition template and customize it.

Procedure

  1. Create a file in your-project-root/mappings/yourflowname-yourmappingstepname. The filename must be in the format yourflowname-yourmappingstepname-version.mapping.json.
  2. In a text editor, copy the mapping definition template to your mapping definition file and replace the values accordingly.

    You can assign values to each entity property:

    • by directly assigning the value of a source field,
    • by using a custom or built-in (Data Hub or TDE) function that calculates a value based on one or more source fields, or
    • by using an expression that resolves to a value.

Example

The following example shows a mapping definition that directly assigns the value of a field to the entity property, uses a custom sumFunction to calculate the value, and includes a conditional expression to determine the value.

   {
    "language" : "zxx",
    "name" : "MyFlow-MyMappingStep",
    "description" : "",
    "version" : 1,
    "targetEntityType" : "MyEntity-0.0.1/MyEntity",
    "sourceContext" : "/",
    "sourceURI" : "",
    "properties" : {
      "id": {
        "sourcedFrom": "CustomerID"
      },
      "sum": {
        "sourcedFrom": "sumFunction(Number, AnotherNumber)"
      }
      "customerPriority": {
        "sourcedFrom": "if (LifetimePurchases gt 500000) then 'Pri1'"
      }
    }
  }

What to do next

Add the name and version of the mapping definition to your mapping step and run the flow. Example:

   "mapping" : {
    "name" : "MyFlow-MyMappingStep",
    "version" : 1
  },