Configure tDynamoDBInput to use an advanced filter to read a JSON document from DynamoDB and use tLogRow to output this document in the console of the Studio.
About this task
Double-click tDynamoDBInput to open its
Click the ... button next to Edit schema to open the schema editor.
- Click the + button twice to add two rows, each representing a column of the sample data, and in the Column column, name these columns to DeliveryId and EventPayload, respectively.
- On the row for the DeliveryId column, select the check box in the Key column to use this DeliveryID column as the partition key column of the DynamoDB table to be used. A DynamoDB table requires a partition key column.
- In the DB Type column, select JSON for the EventPayload column, as this is the column in which the JSON documents are stored.
- In the Access key and Secret key fields, enter the credentials of the AWS account to be used to access your DynamoDB database.
- From the Region drop-down list, select the same region as you selected in the previous steps for tDynamoDBOutput.
- From the Action drop-down list, select Scan.
- In the Table Name field, enter the name of the DynamoDB table to be created by tDynamoDBOutput.
- Select the Use filter expression check box and then the Use advanced filter expression check box.
In the Advanced filter expression field, enter the
filter to be used to select JSON documents.
"EventPayload.customerOrderNumber.deliveryCode = :value"
The part on the left of the equals sign reflects the structure within a JSON document of the sample data, in the EventPayload column. The purpose is to use the value of deliveryCode element to filter the document to be read.
You need to define the
:valueplaceholder in the Value mapping table.
Under the Value mapping table, click the
+ button to add one row and do the following:
In the value column, enter the value of the JSON
element to be used as a filter.
In this example, this element is deliveryCode and you need to extract the JSON document in which the value of the deliveryCode element is 261. As this value is a string, enter 261 within double quotation marks.
If this value is an integer, do not use any quotation marks.
In the Placeholder column, enter the name of the placeholder
to be defined, within double quotation marks. In this example, it is
":value", as you have put in
the Advanced filter
A placeholder name must start with a colon (:).
- In the value column, enter the value of the JSON element to be used as a filter.
- Double-click tLogRow to open its Component view and select the Table radio box to display the extracted data in a table in the console of the Studio.
- Press Ctrl+S to save the Job and press F6 to run it.
Once done, the retrieved JSON document is displayed in the console of the Run view of the Studio.
In the created DynamoDB table, you can see the both of the sample JSON documents.