Skip to main content Skip to complementary content

Creating a DSQL map

Availability-noteBeta
Create a basic mapping with a DSQL map.

Procedure

  1. In the Data Mapper tab of the Mapping perspective, right-click Maps in Hierarchical Mapper and click New > Map.
  2. In the wizard that opens, select DSQL Map and click Next.
  3. Select a folder and enter a name for the map, then click Finish.
    The name must be unique across all maps.
    The map opens in the editor, you can now add the structures.
  4. Drag and drop the input structure from the Hierarchical Mapper on the left section of the editor and the output structure on the right section.
    If your structures have multiple representations, you can click the name of the representation at the top of the editor, JSON in this example, and select another one. For more information, see Adding a representation to a structure.
    A first mapping between the root elements is automatically created. You can see the corresponding Data Shaping Query Language expression in the root element of the output structure.
  5. Right-click the input root element, bikesandscoots in this example, and click Expand all to display all the elements in the structure.
  6. Drag and drop the input make element on the output make element.
    Information noteTip: You can drop the input element on the corresponding element in the output structure, but you can also drop it in the output element's expression editor under the map.
    You can see that the input categories and items elements are connected to the output items element. If you click the output items, you can see that the following expression was generated automatically:
    FROM categories
    UNNEST items

    This expression means that the map should produce one output items element for each items element in each categories element in the input. In the input file used in this example, there are two categories that contain three items each, so the output would contain six items elements.

  7. In the output items element, under the existing expression, add the following clause to filter the output and only keep records related to bicycles.
    WHERE category = 'bicycles'

    Now that the input category element is included in the query, it is connected to the output items element.

  8. Drag and drop the input description element on the corresponding output element.
  9. Click the output price element and enter the following expression to format the output:
    concat(price,' USD')

Results

Your map is configured, you can use the Test Run feature to test it.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!