tributes to retur

 Contents

Dynamo DB component is used to perform CRUD operations on Amazon Dynamo DB. It works with local Dynamo DB instance as well as AWS instance. The component supports XML input and JSON response.

Component Configuration

The following properties can be configured in the Configuration panel as shown below.


Figure 1: Component Configuration Properties

Pre Processing XSL Configuration

Pre Processing XSL configuration can be used to transform request message before processing it. Click the ellipses button against the property to configure the properties.

Refer to the Pre/Post Processing XSL Configuration section under the Common Configurations page for details regarding Pre Processing XSL configuration and Post Processing XSL configuration (below).

Post Processing XSL Configuration

Post Processing XSL configuration can be used to transform the response message before sending it to the output port.

Process Message Based on Property

The property helps components to skip certain messages from processing.

Refer to the Process Message Based On a Property section under the Common Configurations page.

Validate Input

If this attribute is enabled, the service tries to validate the input received. If disabled, service will not validate the input. For more details, refer Validate Input section under Interaction Configurations in the Common Configurations page.

Icon

Performance increases when Validate Input option is disabled, but it may cause undesired results in case the input XML is not valid.

Error handling configuration

The remedial actions to be taken when a particular error occurs can be configured using this attribute. 

Click the ellipses button against this property to configure Error Handling properties for different types of Errors.

Refer to the Error Handling section in the Common Configurations page for detailed information.

AWS Connection Details

Click the AWS Connection Details ellipses  button to configure the properties related to AWS connection.


 Figure 2: AWS Connection Properties

Access key

Specify the Access Key id

Secret key

Specify the Secret Key

Region

The region of the AWS Management console.

Use local DynamoDB

If this option is enabled, the component can be used to connect to DynamoDB instance which is set up locally. Enabling this option makes the property Local DynamoDB URL visible which is hidden by default.

Icon

Local DynamoDB works with any credentials (access key and secret key) and can be used for testing.

Local DynamoDB URL

Specify the hostname and port details of the system where the Dynamo DB instance is running.

Icon

By default, the port number is set to 8000.


Figure 3: Local DynamoDB

DynamoDB Operation Configuration

Click the DynamoDB Operation Configuration ellipses  button to configure different operations to be executed on Dynamo DB instance.

Any of the operations can be added and configured by clicking the Add button and selecting the required operation name from the menu. An operation with default Operation Name and Operation Type will be added to the list of operations.

Operation Name

A unique name for the operation.

Icon

Providing Operation Name is mandatory.

Operation Type

This represents the operation selected from the menu. This field cannot be edited. The operations supported are described in the following table.

Operation TypeDescription
GETITEMRetrieves a single item from the table specified
PUTITEM

Creates a new item or replaces an old item with a new item

UPDATEITEM

Edits an existing item's attributes or adds a new item to the table if it does not already exist

DELETEITEM

Deletes a single item in a table by primary key

QUERY

Finds items based on primary key values

SCAN

Returns one or more items and item attributes by accessing every item in a table or a secondary index

BATCHGETITEM

Returns the attributes of one or more items from one or more tables

BATCHWRITEITEM

Puts or deletes multiple items in one or more tables

Add

To generate a list of operation types which can be used for configuring different operations.

Delete

To delete an operation from the operation list. The operation selected will be removed from the list.

Delete All

To delete all operations in the operation list.

GETITEM

This operation is used to retrieve an item from Dynamo DB, based on the primary key attributes provided in CPS. The following are the properties which can be configured for this operation.

Click Add and choose the GETITEM operation from the drop-down.


Figure 4: Operation Configuration Dialogue Box After Selecting The Get Operation

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Use Consistent Read

If this option is selected, the operation uses strongly consistent reads, otherwise, the operation uses eventually consistent reads. This option is disabled by default.

Select to specify list of attributes to return

Select this option to show the table where the list of item attributes can be specified to return those set of item attributes instead of all attributes after executing the operation. When this option is selected, a table with the label Specify Attributes to return will be shown where the attributes can be specified.

Specify Attributes to return

Refer to the Specifying Attributes to return section for more details.


Figure 5: Selecting The Table And Adding The List Of Attributes To Be Returned

Primary key attributes

Provide the primary key attributes of the item to be retrieved. The primary key attributes are populated in the list when the table name is selected from the drop-down if the component connects to Dynamo DB instance successfully. The list can be optionally modified using Add, Delete and Delete All buttons.

Refer to the Specifying Input Attributes section for more details.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified. 

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.


Figure 6: Adding Primary Key Attributes and giving Attribute Name Placeholders to them

PUTITEM

This operation is used to create a new item, or replace an old item with a new item in DynamoDB.

Select the Add option and choose "PUTITEM" from the drop-down menu.


Figure 7: Selecting the table and adding the list of attributes to be inserted.

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Provide attributes to be inserted

Provide the list of attributes to be inserted for the item. Primary key attributes are compulsory. The user can optionally provide other attributes.

Select Return values type

Specify this setting if item attributes are to be retrieved as they appeared before they are updated with the put-item request.


Figure 8: Providing the Return Value type and providing the Condition expression

Possible values are:

  • NONE: This is the default setting which means nothing is returned.
  • ALL_OLD: If put-item overwrote an attribute name-value pair, then the content of the old item is returned.
Select to specify condition expression

When this option is selected, a browsable text area with the label Condition expression will be visible where the condition expression can be specified.

Condition expression

Specify the condition that must be satisfied in order for the put-item operation to succeed.

Refer to the Expressions, Operators and Functions section for information on how to configure condition expression.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified.

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.

Select to use attribute value placeholder

Select this option to show the table where attribute value placeholders can be specified. 


Figure 9: Providing the attribute value placeholder for the Primary Key

Attribute value placeholders

Refer to the Specifying Attribute value placeholders section for details.

UPDATEITEM

This operation edits an existing item's attributes or adds a new item to the table if it does not exist already. Users can also perform a conditional update on an existing item (insert a new attribute name-value pair if it does not exist, or replace an existing name-value pair if it has certain expected attribute values).

Select the Add option and choose "UPDATEITEM" from the drop-down.


Figure 10: Providing the Table Name, Primary Key Attributes, and the Return Values Type

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Primary key attributes

Provide the primary key attributes of the item to be retrieved. The primary key attributes are populated in the list when the table name is selected from the drop-down if the component connects to Dynamo DB instance successfully. The user can optionally modify the list using Add, Delete and Delete All buttons.

Refer to the Specifying Input Attributes section for more details.

Select Return values type

Specify this setting if item attributes are to be retrieved as they appeared before or after they were updated with the update-item request. Possible values are

  • NONE: This is the default setting which means nothing is returned.
  • ALL_OLD: Returns all of the attributes of the item, as they appeared before the update-item operation.
  • UPDATED_OLD: Returns only the updated attributes, as they appeared before the update-item operation.
  • ALL_NEW: Returns all of the attributes of the item, as they appear after the update-item operation.
  • UPDATED_NEW: Returns only the updated attributes, as they appear after the update-item operation.
Update expression

Update expression indicates the attributes that are to be modified and the values to be assigned to them. An update expression specifies how update-item will modify the attributes of an item, for example, setting a scalar value, or removing elements from a list or a map. 


Figure 11: Providing the Update expression

Syntax

An update expression consists of one or more clauses. Each clause begins with a SET, REMOVE, ADD or DELETE keyword. Any of these clauses can be included in an update expression, in any order. However, each action keyword can appear only once.

Within each clause are one or more actions, separated by commas. Each action represents a data modification.

SET-Modifying or Adding Item Attributes

Use the SET action in an update expression to add one or more attributes to an item. If any of these attributes already exist, they are overwritten by the new values. To perform multiple SET actions, separate them by commas.

In the following syntax summary:

  • The path element is the document path to the item.
  • An operand element can be either a document path to an item or a function.
Syntax

Consider the sample item whose structure is mentioned in the Sample Product Category Item section. Some of the operations that can be performed using SET action are listed below.

  • Modifying attributes: To update the ProductCategory and Price attributes, specify the expression as follows: "SET ProductCategory = :c, Price = :p" where c and p are expression attribute values whose values can be defined as follows.

    ":c"- "Hardware"

    ":p"- 60"

  • Adding Lists and Maps: This example adds a new list and a new map. "SET RelatedItems = :ri, ProductReviews = :pr" where ri and pr are expression attribute values whose values can be defined as follows.

    ":ri"- ["Hammer"]

    ":pr"- {"FiveStar": ["Best product ever!"]}

  • Incrementing and Decrementing Numeric Attributes: One can add to or subtract from an existing numeric attribute. To do this, use the + (plus) and - (minus) operators. For example: "SET Price = Price - :p" where ":p" holds the value 15.

REMOVE-Deleting Attributes from An Item

Use the REMOVE action in an update expression to remove one or more attributes from an item. To perform multiple REMOVE actions, separate them by commas.

The following is a syntax summary for REMOVE in an update expression. The only operand is the document path for the attribute you want to remove:

Syntax

Example: Remove Brand, InStock, and QuantityOnHand attributes from the item. The update expression can be specified as follows: "REMOVE Brand, InStock, QuantityOnHand"

ADD-Updating Numbers and Sets

Use the ADD action in an update expression to add a new attribute and its value(s) to an item. If the attribute already exists, then the behavior of ADD depends on the attribute's data type:

  • If the attribute is a number, and the value to be added is also a number, then the value is mathematically added to the existing attribute. (If the value is a negative number, then it is subtracted from the existing attribute.)
  • If the attribute is a set, and the value to be added is also a set, then the value is appended to the existing set.

To perform multiple ADD actions, separate them by commas.

In the following syntax summary:

  • The path element is the document path to an attribute. The attribute must be either a Number or a set data type.
  • The value element is a number that you want to add to the attribute (for Number data types), or a set to append to the attribute (for set types).

Syntax

Example: Assume that the QuantityOnHand attribute does not exist. The following update expression sets QuantityOnHand to 5: "ADD QuantityOnHand :q"

DELETE-Removing Elements From A Set

Use the DELETE action in an update expression to remove one or more elements from a set. To perform multiple DELETE actions, separate them by commas.

In the following syntax summary:

  • The path element is the document path to an attribute. The attribute must be a set data type.
  • The subset is one or more elements which can be deleted from the path. that you want to delete. You must specify subset as a set type.
Syntax

Example: This example removes some of the elements from the Colors string set: "DELETE Color :p" where,

":p" - ["Yellow", "Orange"]

For a complete list of operations possible with update expressions refer to the following link: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html

Select to specify condition expression

When this option is selected, a browsable text area with the label Condition expression will be visible where the condition expression can be specified.


Figure 12: Providing the Condition expression

Condition expression

Specify the condition that must be satisfied in order for the update-item operation to succeed.

Refer to the Expressions, Operators and Functions section for information on how to configure condition expression.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified. 


Figure 13: Providing the Attribute Value Placeholders values to be used In the Conditional Expression.

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.

DELETEITEM

Deletes a single item in a table by primary key. One can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value. The Delete Item is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response. 

Select the Add option and choose "DELETEITEM" from the drop-down.


Figure 14: Selecting the table for which the Delete operation is to be performed

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Primary key attributes

Provide the primary key attributes of the item to be deleted. The primary key attributes are populated in the list when the table name is selected from the drop-down when the component connects to Dynamo DB instance successfully. The user can optionally modify the list using Add, Delete and Delete All buttons.


Figure 15: Adding the Primary Key value and selecting the Return value type

Refer to the Specifying Input Attributes section for more details.

Select Return values type

Specify this setting if item attributes are to be retrieved as they appeared before they were deleted with the delete-item request. Possible values are

  • NONE: This is the default setting which means nothing is returned.
  • ALL_OLD: The content of the old item is returned.  
Select to specify condition expression

When this option is selected, a browsable text area with the label Condition expression will be visible where the condition expression can be specified.

Condition expression

Specify the condition that must be satisfied in order for the delete-item operation to succeed.


Figure 16: Providing the Conditional expression and adding the Attribute value placeholders

Refer to the Expressions, Operators and Functions section for information on how to configure condition expression.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified.

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.

Select to use attribute value placeholder

Select this option to show the table where attribute value placeholders can be specified.

Attribute value placeholders

Refer to the Specifying Attribute value placeholders section for details.

QUERY

The Query operation finds items based on primary key values. Users can query any table or secondary index that has a composite primary key (a partition key and a sort key).

Select Add and choose "QUERY" from the drop-down.


Figure 17: Selecting the table after choosing the Query operation type

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Select to specify index to query

Select this option to specify the secondary index on which query operation needs to be performed. Selecting this option will enable Index name drop-down where users can specify secondary index if present.


Figure 18: Checking Scan Index Forward and providing the Attributes list to be returned

Use Consistent Read

If this option is selected, then the operation uses strongly consistent reads, otherwise, the operation uses eventually consistent reads. This option is unchecked by default.

Scan Index forward

Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false, the traversal is performed in descending order. If this is set to true, Dynamo DB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If set to is false, Dynamo DB reads the results in reverse order by sort key value and then returns the results to the client.

Select to specify list of attributes to return

Select this option to show the table where the list of item attributes can be specified to return those set of item attributes instead of all attributes after executing the operation. When this option is selected, a table with the label Specify Attributes to return will be shown where the attributes can be specified.

Specify Attributes to return

Refer to the Specifying Attributes to return section for more details.

Condition expression

The Query operation finds items based on primary key values. Users must provide the name of the partition key attribute, and a single value for that attribute. Query will return all of the items with that partition key value. Users can optionally provide a sort key attribute, and use a comparison operator to refine the search results.

Specify the partition key name and value as an equality condition and optionally provide sort key condition with any of the comparison operators.


Figure 19: Providing the Condition expression, Filter expression and the list of Attribute placeholders

Refer to the Expressions, Operators and Functions section to understand the syntax for specifying the condition expression.

Select to specify filter expression

Select this option to specify the filter expression for the query operation.

Filter expression

If a user needs to further refine the Query results, a filter expression can be provided. A filter expression determines which items within the Query results should be returned to the user. All of the other results are discarded. A filter expression is applied after a Query finishes, but before the results are returned. Therefore, a Query will consume the same amount of read capacity, regardless of whether a filter expression is present.

A filter expression cannot contain partition key or sort key attributes. A user needs to specify those attributes in the key condition expression, not the filter expression.

The syntax for a filter expression is identical to that of a condition expression. Refer to the Expressions, Operators and Functions section to understand the syntax for specifying the filter expression.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified.

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.

Select to use attribute value placeholder

Select this option to show the table where attribute value placeholders can be specified. 


Figure 20: Providing Attribute value placeholders, Page Size, and the Max result size

Attribute value placeholder

Refer to the Specifying Attribute value placeholders section for details.

Select to specify page size

Select this option to specify Page size under the label Page Size.

Page Size

The size of each page to get in the AWS service call. This does not affect the number of items returned in the output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.

Select to specify max result size

Select this option to specify Max result size under the label Max result size.

Max result size

This property is used to specify the maximum number of items we want in the result set. The final result will contain those many items as specified by this property or fewer, depending on the number of items that were filtered.

Select to specify exclusive start key

Select this option to specify exclusive start key for the operation.

Exclusive start key

This property is used to specify primary key of the item where the operation stopped, inclusive of the previous result set. This value can be used to start a new operation, excluding this value in the new request.

The same rules that apply for specifying the primary key for delete-item, update-item, get-item operations apply here too.

Refer to the Specifying Input Attributes section for more details.

SCAN

The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. 

Click Add and select "ProductCatalog" from the Select a table drop-down.


Figure 21: Selecting the Table and providing the number of segments As "1"

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down.

Select to specify index to query

Select this option to specify the secondary index on which query operation needs to be performed. Selecting this option will enable Index name drop-down where users can specify secondary index if present.

Use Consistent Read

If this option is selected, then the operation uses strongly consistent reads, otherwise, the operation uses eventually consistent reads. This option is unchecked by default.

Select to specify total number of segments

Select this option to specify the total number of segments under the label Total segments. Select this option to perform a parallel scan request by specifying the total number of segments.

Total segments

For a parallel scan request, Total segments represent the total number of segments into which the scan operation will be divided. The value of Total segments corresponds to the number of application workers that will perform the parallel scan. For example, if the user wants to use four application threads to scan a table or an index, then specify the value of Total segments as "4".

Select to specify list of attributes to return

Select this option to show the table where the list of item attributes can be specified to return those set of item attributes instead of all attributes after executing the operation. When this option is selected, a table with the label Specify Attributes to return will be shown where the attributes can be specified.


Figure 22: Selecting the list Of attributes to return and providing the Filter expression.

Specify Attributes to return

Refer to the Specifying Attributes to return section for more details.

Select to specify filter expression

Select this option to specify a filter expression for the Query operation.

Filter expression

A string that contains conditions that Dynamo DB applies after the scan operation, but before the data is returned to the user. Items that do not satisfy the Filter Expression criteria are not returned.

The syntax for a filter expression is identical to that of a condition expression. Refer to the Expressions, Operators and Functions section to understand the syntax for specifying the filter expression.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified.


Figure 23: Providing Attribute name placeholder.

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for details.

Select to use attribute value placeholder

Select this option to show the table where attribute value placeholders can be specified. 


Figure 24: Providing Attribute value placeholder and the page size

Attribute value placeholder

Refer to the Specifying Attribute value placeholders section for details.

Select to specify page size

Select this option to specify Page size under the label Page Size.

Page Size

The size of each page to get in the AWS service call. This does not affect the number of items returned in the output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.

Select to specify max result size

Select this option to specify Max result size under the label Max result size.


Figure 25: Providing the Maximum Result Size and the Exclusive Start Key

Max result size

This property is used to specify the maximum number of items we want in the result set. The final result will contain those many items as specified by this property or fewer, depending on the number of items that were filtered.

Select to specify exclusive start key

Select this option to specify exclusive start key for the operation.

Exclusive start key

This property is used to specify primary key of the item where the operation stopped, inclusive of the previous result set. This value can be used to start a new operation, excluding this value in the new request.

The same rules that apply for specifying the primary key for delete-item, update-item, get-item operations apply here too.

Refer to the Specifying Input Attributes section for more details.

BATCHGETITEM

This operation returns the attributes of one or more items from one or more tables. Select the operation type as BATCHGETITEM.


Figure 26: Selecting the Operation Type as BatchGetItem

Configure each Get-Item item that pertains to one table as shown in the figure.

Each Get-Item item can be added using Add button which adds a configuration with a default name, say GetItem0 to the list of get-item configuration objects. The Get-Item items can be deleted using Delete and Delete All buttons.


Figure 27: Select the number of Get operations which are to be performed

The properties that can be configured for each get-item item in cps are as follows. These properties are similar to those present in GetItem operation.

Select a table

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down. The table name chosen should be unique across all Get-Item entries.


Figure 28: The CPS of the GetItem0 where its configured as required

Use Consistent Read

If this option is selected, then the operation uses strongly consistent reads, otherwise, the operation uses eventually consistent reads. This option is unchecked by default.

Select to specify list of attributes to return

Select this option to show the table where the list of item attributes can be specified to return those set of item attributes instead of all attributes after executing the operation. When this option is selected, a table with the label Specify Attributes to return will be shown where the attributes can be specified.

Specify Attributes to return

Refer to the Specifying Attributes to return section for more details.

Primary key attributes

Provide the primary key attributes of the item to be retrieved. The primary key attributes are populated in the list when the table name is selected from the drop-down if the component connects to Dynamo DB instance successfully. The user can optionally modify the list using Add, Delete and Delete All buttons.

Refer to the Specifying Input Attributes section for more details.

Select to use attribute name placeholder

Select this option to show the table where attribute name placeholders can be specified. 

Attribute name placeholders

Refer to the Specifying Attribute name placeholders section for more details.

Get Item count

Specify the number of items to retrieve from the table specified.


Figure 29: The CPS of the GetItem1 where its configured as required

BATCHWRITEITEM

This operation puts or deletes multiple items in one or more tables.

This operation uses a list of Write Item items and constructs the batch write item request.  These can be added in Write Item table as shown in the figure. Use Add, Delete and Delete All buttons to add/delete write items from this table.


Figure 30: Providing the Operation Type as "BatchWriteItem" and selecting the table from the drop-down

Each Write Item has the following properties.

Write Item name

A unique name for the write item. This cannot be empty.

Table name

Choose a table from the drop-down on which the operation needs to be performed. The list of tables based on the Dynamo DB configuration provided in AWS connection details will be loaded in this drop-down. The table name chosen should be unique across all write item entries in the table.

Each Write Item will have one or more put-item and/or delete-item operations that can be configured as shown in the figure below. As each Write Item pertains to a particular table name as configured above, the operations defined in this table will be executed against that table. These operations can be added or deleted by using Add, Delete and Delete All buttons in the operation table. Clicking on Add and selecting an operation will add that operation with default Operation Name and Operation Type to the list of operations. The operations that can be chosen to be added are PUTITEM and DELETEITEM.


Figure 31: Providing the list of attributes to be inserted for the Put operation



Figure 32: Providing the Primary Key Attribute based on which the Delete operation is to be performed

Configuring Dynamo DB Common Properties

Specifying Attributes to return

Use the Add button to add attributes to the list. Delete button deletes the selected attribute and Delete All button deletes all attributes in the list. If no attributes are specified in this list, then the operation returns all attributes for that item returned. Dynamo DB constructs a string based on this list which is known as Projection Expression.

If any attribute has placeholders defined under Attribute name placeholders, then specify the placeholder value in this list.

Example: if year, title, author are the attributes that are to be returned in the response and year has placeholder defined as yr in the Attribute name placeholders list, then specify the attribute as #yr in the Specify Attributes to return list. The projection expression constructed by Dynamo DB will be as follows: "#yr, title, author".

Specifying Input Attributes

Each row in the table will have the following properties.

Name

Specify the name of the attribute. Providing this value is mandatory.

DataType

The data types supported by Dynamo DB are represented in the component as listed in the table (refer to the table). The primary key attributes can be of String, Number, and Binary data types only.

Dynamo DB Data typeRepresentation in the componentDescription
NumberINTEGER, SHORT, FLOAT, DOUBLE, LONG, BIGDECIMAL, BIGINTEGERBased on the precision needed, different number types can be chosen. All of these types will be represented as Number type in Dynamo DB. These types can also be used to represent date and time stamp using epoch time. For example, the epoch time 1437136300  represents 12:31:40 PM UTC on 17 July 2015.
StringSTRINGNormal strings are supported. This can be used to represent a date or a time stamp using ISO 8601 strings. Example: 2016-02-15,   2015-12-21T17:42:34Z, 20150311T122706Z
BinaryBINARYThe input string will be converted into base64 encoded string and stored in Dynamo DB. In case of Get Item operations where we retrieve items, the attribute value for the binary attribute will be in base64 encoded form.
NullNULLNull represents an attribute with an unknown or undefined state. This can be used in case the attribute value is unknown.
BooleanBOOLEANIt can store either true or false.
NumberSetINTEGERSET, SHORTSET, FLOATSET, DOUBLESET, LONGSET, BIGDECIMALSET, BIGINTEGERSETSupports multiple scalar values of the respective Number type.
StringSetSTRINGSETSupports multiple scalar values of String type.
BinarySetBINARYSETEach input string in the set will be converted into base64 encoded string and stored in Dynamo DB. In case of Get Item operations where we retrieve items, the individual values in the set will be in base64 encoded form.
DocumentJSON

A document type can represent a complex structure with nested attributes such as we would find in a JSON document. The document types are list and map. The list is similar to JSON array and map is similar to JSON object. Lists and Maps will be stored as JSON strings in Dynamo DB.

Example: ["Cookies", "Coffee", 3.14159], {"plot":"Nothing happens at all.","rating":"0"} etc.

Select the appropriate data type from the drop-down in cps.

AttributeType

The AttributeType can be one of the following values.

  • HASH: Select this option if the attribute is a hash key (also known as partition key).
  • RANGE: Select this option if the attribute is a range key (also known as sort key).
  • NONE: Select this option for non-key attributes.
Specifying Attribute name placeholders

Attribute name placeholders will be used as placeholders for attribute names in projection expression, condition expressions, and filter expressions. Prefix these placeholders with # (hash) character when used in condition expressions, filter expressions and attributes to return list, but do not prefix the # (hash) character for the attribute name placeholders in this list. The # (hash) character will be substituted in this list as needed by the component during execution. In Dynamo DB terminology, these placeholders are referred as Expression Attribute Names.

The following are the situations to use expression attribute names. Consider the sample item structure as mentioned in the Sample Product Category Item section.

  • Attribute name conflicts with a reserved word
    • Example: If the condition expression/filter expression/projection expression contains "Comment" attribute, then the operation would fail as Comment is a reserved word in Dynamo DB. Refer to the Reserved Words section for a complete list of reserved words. To work around this, Comment can be replaced with an expression attribute name such as #c. The # (pound sign) is required and indicates that this is a placeholder for an attribute name.
  • Attribute Names Containing Dots
    • To retrieve the Safety.Warning attribute from a ProductCatalog item with the expected string value "Always wear a helmet", Dynamo DB would return an empty result as it interprets a dot in an expression as a document path separator. In this case, a substitute such as #sw can be defined for Safety.Warning and used in expressions.
  • Nested Attributes
    • To access nested attribute ProductReviews.OneStar using expression attribute name, one cannot substitute say #pr1star in projection expression. Dynamo DB would return an empty result, instead of the expected map of one-star reviews as it interprets a dot in an expression attribute value as a character within an attribute's name. 

      The correct approach would be to define an expression attribute name for each element in the document path and use #pr.#1star in projection expression.

      #pr - ProductReviews

      #1star - OneStar

  • Repeating Attribute Names

    Expression attribute names are helpful when the same attribute name has to be used repeatedly. For example, consider the following projection expression for retrieving some of the reviews from a ProductCatalog item:

    • "ProductReviews.FiveStar, ProductReviews.ThreeStar, ProductReviews.OneStar"

                            With expression attribute name, the same projection expression can be written as "#pr.FiveStar, #pr.ThreeStar, #pr.OneStar" where #pr is the substitute for ProductReviews.

Icon

Once an expression attribute name is defined, it must be used consistently throughout the entire expression, where the # symbol cannot be omitted.

Source link: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html

Specifying Attribute value placeholders

Define substitutes for attribute values which will be used in condition expressions and filter expressions. Prefix these placeholders with : (colon) character when used in condition expressions and filter expressions, but do not prefix the : (colon) character for the attribute value placeholders in this list. The : (colon) character will be substituted in this list as needed by the component during execution In DynamoDB terminology, these placeholders are referred as Expression Attribute Values.

If there is a need to compare an attribute with a value, define an expression attribute value as a placeholder. Expression attribute values are substitutes for the actual values that are used to compare - values that might not be known until run-time.

If an expression attribute value is defined, it must be used consistently throughout the entire expression. Also, the : symbol cannot be omitted.

Expression attribute values are used with condition expressions, update expressions, and filter expressions.

Consider the sample item structure as mentioned in the Sample Product Category Item section. Suppose a user wants to return all of the ProductCatalog items that are available in Black and cost 500 or less. A Scan operation can be used with a filter expression as follows:

where,

  • :c - "Black",
  • :p - 500

Source link: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeValues.html

Reserved Words
List#1List#2List#3List#4List#5

ABORT

ABSOLUTE

ACTION

ADD

AFTER

AGENT

AGGREGATE

ALL

ALLOCATE

ALTER

ANALYZE

AND

ANY

ARCHIVE

ARE

ARRAY

AS

ASC

ASCII

ASENSITIVE

ASSERTION

ASYMMETRIC

AT

ATOMIC

ATTACH

ATTRIBUTE

AUTH

AUTHORIZATION

AUTHORIZE

AUTO

AVG

BACK

BACKUP

BASE

BATCH

BEFORE

BEGIN

BETWEEN

BIGINT

BINARY

BIT

BLOB

BLOCK

BOOLEAN

BOTH

BREADTH

BUCKET

BULK

BY

BYTE

CALL

CALLED

CALLING

CAPACITY

CASCADE

CASCADED

CASE

CAST

CATALOG

CHAR

CHARACTER

CHECK

CLASS

CLOB

CLOSE

CLUSTER

CLUSTERED

CLUSTERING

CLUSTERS

COALESCE

COLLATE

COLLATION

COLLECTION

COLUMN

COLUMNS

COMBINE

COMMENT

COMMIT

COMPACT

COMPILE

COMPRESS

CONDITION

CONFLICT

CONNECT

CONNECTION

CONSISTENCY

CONSISTENT

CONSTRAINT

CONSTRAINTS

CONSTRUCTOR

CONSUMED

CONTINUE

CONVERT

COPY

CORRESPONDING

COUNT

COUNTER

CREATE

CROSS

CUBE

CURRENT

CURSOR

CYCLE

DATA

DATABASE

DATE

DATETIME

DAY

DEALLOCATE

DEC

DECIMAL

DECLARE

DEFAULT

DEFERRABLE

DEFERRED

DEFINE

DEFINED

DEFINITION

DELETE

DELIMITED

DEPTH

DEREF

DESC

DESCRIBE

DESCRIPTOR

DETACH

DETERMINISTIC

DIAGNOSTICS

DIRECTORIES

DISABLE

DISCONNECT

DISTINCT

DISTRIBUTE

DO

DOMAIN

DOUBLE

DROP

DUMP

DURATION

DYNAMIC

EACH

ELEMENT

ELSE

ELSEIF

EMPTY

ENABLE

END

EQUAL

EQUALS

ERROR

ESCAPE

ESCAPED

EVAL

EVALUATE

EXCEEDED

EXCEPT

EXCEPTION

EXCEPTIONS

EXCLUSIVE

EXEC

EXECUTE

EXISTS

EXIT

EXPLAIN

EXPLODE

EXPORT

EXPRESSION

EXTENDED

EXTERNAL

EXTRACT

FAIL

FALSE

FAMILY

FETCH

FIELDS

FILE

FILTER

FILTERING

FINAL

FINISH

FIRST

FIXED

FLATTERN

FLOAT

FOR

FORCE

FOREIGN

FORMAT

FORWARD

FOUND

FREE

FROM

FULL

FUNCTION

FUNCTIONS

GENERAL

GENERATE

GET

GLOB

GLOBAL

GO

GOTO

GRANT

GREATER

GROUP

GROUPING

HANDLER

HASH

HAVE

HAVING

HEAP

HIDDEN

HOLD

HOUR

IDENTIFIED

IDENTITY

IF

IGNORE

IMMEDIATE

IMPORT

IN

INCLUDING

INCLUSIVE

INCREMENT

INCREMENTAL

INDEX

INDEXED

INDEXES

INDICATOR

INFINITE

INITIALLY

INLINE

INNER

INNTER

INOUT

INPUT

INSENSITIVE

INSERT

INSTEAD

INT

INTEGER

INTERSECT

INTERVAL

INTO

INVALIDATE

IS

ISOLATION

ITEM

ITEMS

ITERATE

JOIN

KEY

KEYS

LAG

LANGUAGE

LARGE

LAST

LATERAL

LEAD

LEADING

LEAVE

LEFT

LENGTH

LESS

LEVEL

LIKE

LIMIT

LIMITED

LINES

LIST

LOAD

LOCAL

LOCALTIME

LOCALTIMESTAMP

LOCATION

LOCATOR

LOCK

LOCKS

LOG

LOGED

LONG

LOOP

LOWER

MAP

MATCH

MATERIALIZED

MAX

MAXLEN

MEMBER

MERGE

METHOD

METRICS

MIN

MINUS

MINUTE

MISSING

MOD

MODE

MODIFIES

MODIFY

MODULE

MONTH

MULTI

MULTISET

NAME

NAMES

NATIONAL

NATURAL

NCHAR

NCLOB

NEW

NEXT

NO

NONE

NOT

NULL

NULLIF

NUMBER

NUMERIC

OBJECT

OF

OFFLINE

OFFSET

OLD

ON

ONLINE

ONLY

OPAQUE

OPEN

OPERATOR

OPTION

OR

ORDER

ORDINALITY

OTHER

OTHERS

OUT

OUTER

OUTPUT

OVER

OVERLAPS

OVERRIDE

OWNER

PAD

PARALLEL

PARAMETER

PARAMETERS

PARTIAL

PARTITION

PARTITIONED

PARTITIONS

PATH

PERCENT

PERCENTILE

PERMISSION

PERMISSIONS

PIPE

PIPELINED

PLAN

POOL

POSITION

PRECISION

PREPARE

PRESERVE

PRIMARY

PRIOR

PRIVATE

PRIVILEGES

PROCEDURE

PROCESSED

PROJECT

PROJECTION

PROPERTY

PROVISIONING

PUBLIC

PUT

QUERY

QUIT

QUORUM

RAISE

RANDOM

RANGE

RANK

RAW

READ

READS

REAL

REBUILD

RECORD

RECURSIVE

REDUCE

REF

REFERENCE

REFERENCES

REFERENCING

REGEXP

REGION

REINDEX

RELATIVE

RELEASE

REMAINDER

RENAME

REPEAT

REPLACE

REQUEST

RESET

RESIGNAL

RESOURCE

RESPONSE

RESTORE

RESTRICT

RESULT

RETURN

RETURNING

RETURNS

REVERSE

REVOKE

RIGHT

ROLE

ROLES

ROLLBACK

ROLLUP

ROUTINE

ROW

ROWS

RULE

RULES

SAMPLE

SATISFIES

SAVE

SAVEPOINT

SCAN

SCHEMA

SCOPE

SCROLL

SEARCH

SECOND

SECTION

SEGMENT

SEGMENTS

SELECT

SELF

SEMI

SENSITIVE

SEPARATE

SEQUENCE

SERIALIZABLE

SESSION

SET

SETS

SHARD

SHARE

SHARED

SHORT

SHOW

SIGNAL

SIMILAR

SIZE

SKEWED

SMALLINT

SNAPSHOT

SOME

SOURCE

SPACE

SPACES

SPARSE

SPECIFIC

SPECIFICTYPE

SPLIT

SQL

SQLCODE

SQLERROR

SQLEXCEPTION

SQLSTATE

SQLWARNING

START

STATE

STATIC

STATUS

STORAGE

STORE

STORED

STREAM

STRING

STRUCT

STYLE

SUB

SUBMULTISET

SUBPARTITION

SUBSTRING

SUBTYPE

SUM

SUPER

SYMMETRIC

SYNONYM

SYSTEM

TABLE

TABLESAMPLE

TEMP

TEMPORARY

TERMINATED

TEXT

THAN

THEN

THROUGHPUT

TIME

TIMESTAMP

TIMEZONE

TINYINT

TO

TOKEN

TOTAL

TOUCH

TRAILING

TRANSACTION

TRANSFORM

TRANSLATE

TRANSLATION

TREAT

TRIGGER

TRIM

TRUE

TRUNCATE

TTL

TUPLE

TYPE

UNDER

UNDO

UNION

UNIQUE

UNIT

UNKNOWN

UNLOGGED

UNNEST

UNPROCESSED

UNSIGNED

UNTIL

UPDATE

UPPER

URL

USAGE

USE

USER

USERS

USING

UUID

VACUUM

VALUE

VALUED

VALUES

VARCHAR

VARIABLE

VARIANCE

VARINT

VARYING

VIEW

VIEWS

VIRTUAL

VOID

WAIT

WHEN

WHENEVER

WHERE

WHILE

WINDOW

WITH

WITHIN

WITHOUT

WORK

WRAPPED

WRITE

YEAR

ZONE

Source link: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html

Sample Product Category Item
Expressions, Operators and Functions

In the following syntax summary, an operand can be the following:

  • A top-level attribute such as Id, Title or ProductCategory

  • A document path that references a nested attribute

 

Syntax for condition expression

Making Comparisons

Use these comparators to compare an operand against a range of values, or an enumerated list of values:

  • a = b - true if a is equal to b
  • a <> b - true if a is not equal to b
  • a < b - true if a is less than b
  • a <= b - true if a is less than or equal to b
  • a > b - true if a is greater than b
  • a >= b - true if a is greater than or equal to b

Use the BETWEEN and IN keywords to compare an operand against a range of values, or an enumerated list of values:

  • a BETWEEN b AND c - true if a is greater than or equal to b, and less than or equal to c.
  • a IN (b, c, d) - true if a is equal to any value in the list - for example, any of b, c or d. The list can contain up to 100 values, separated by commas.

Functions

Use functions in the table below to determine whether an attribute exists in an item, or to evaluate the value of an attribute.

Icon
  • These function names are case-sensitive.
  • For a nested attribute, you must provide its full document path.
FunctionDescription
attribute_exists (path)

True if the item contains the attribute specified by path.

Example: Check whether an item in the Product table has a side view picture.

  • attribute_exists (Pictures.SideView)
attribute_not_exists (path)

True if the attribute specified by path does not exist in the item.

Example: Check whether an item has a Manufacturer attribute

  • attribute_not_exists (Manufacturer)
attribute_type (path, type)

True if the attribute at the specified path is of a particular data type. The type parameter must be one of the following:

    S - String

    SS - String Set

    N - Number

    NS - Number Set

    B - Binary

    BS - Binary Set

    BOOL - Boolean

    NULL - Null

    L - List

    M - Map

 

You must use an expression attribute value for the type parameter.

Example: Check whether the QuantityOnHand attribute is of type List. In this example, :v_sub is a placeholder for the string L.

  • attribute_type (ProductReviews.FiveStar, :v_sub)

You must use an expression attribute value for the type parameter.

 

begins_with (path, substr)

True if the attribute specified by path begins with a particular substring.

Example: Check whether the first few characters of the front view picture URL are http://.

  • begins_with (Pictures.FrontView, :v_sub)

The expression attribute value :v_sub is a placeholder for http://.

contains (path, operand)

True if the attribute specified by path is:

    a String that contains a particular substring.

    a Set that contains a particular element within the set.

In either case, operand must be a String.

The path and the operand must be distinct; that is, contains (a, a) will return an error.

Example: Check whether the Brand attribute contains the substring Company.

  • contains (Brand, :v_sub)

The expression attribute value :v_sub is a placeholder for Company.

Example: Check whether the product is available in red.

  • contains (Color, :v_sub)

The expression attribute value :v_sub is a placeholder for Red.

size (path)

Returns a number representing an attribute's size. The following are valid data types for use with size.

If the attribute is of type String, size returns the length of the string.

Example: Check whether the string Brand is less than or equal to 20 characters. The expression attribute value :v_sub is a placeholder for 20.

  • size (Brand) <= :v_sub

If the attribute is of type Binary, size returns the number of bytes in the attribute value.

Example: Suppose that the ProductCatalog item has a Binary attribute named VideoClip, which contains a short video of the product in use. The following expression checks whether VideoClip exceeds 64,000 bytes. The expression attribute value :v_sub is a placeholder for 64000.

  • size(VideoClip) > :v_sub

If the attribute is a Set data type, size returns the number of elements in the set.

Example: Check whether the product is available in more than one color. The expression attribute value :v_sub is a placeholder for 1.

  • size (Color) < :v_sub

If the attribute is of type List or Map, size returns the number of child elements.

Example: Check whether the number of OneStar reviews has exceeded a certain threshold. The expression attribute value :v_sub is a placeholder for 3.

  • size(ProductReviews.OneStar) > :v_sub

Logical Evaluations

Use the AND, OR and NOT keywords to perform logical evaluations. In the list following, a and b represent conditions to be evaluated.

  • a AND b - true if a and b are both true.
  • a OR b - true if either a or b (or both) are true.
  • NOT a - true if a is false; false if a is true.

Parentheses

Use parentheses to change the precedence of a logical evaluation. For example, suppose that conditions a and b are true, and that condition c is false. The following expression evaluates to true:

  • a OR b AND c

However, if you enclose a condition in parentheses, it is evaluated first. For example, the following evaluates to false:

  • (a OR b) AND c

Note: You can nest parentheses in an expression. The innermost ones are evaluated first.

Precedence in Conditions

Dynamo DB evaluates conditions from left to right using the following precedence rules:

  •     = <> < <= > >=
  •     IN
  •     BETWEEN
  •     attribute_exists, attribute_not_exists, begins_with, contains
  •     Parentheses
  •     NOT
  •     AND
  •     OR

Source link: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.OperatorsAndFunctions.html

Send empty response

This property is selected by default. When this is selected, the component sends an empty JSON object (which is "{}") in case there is no matching item to fetch from Dynamo DB.

Example: Consider a table called ProductCatalog whose primary key is Id. When GetItem operation is used to fetch an item whose primary key is say Id=101 this primary key doesn't exist in Dynamo DB, then the response returned will be {}.

Target Namespace

Refer the Target Namespace section in the Common Configurations page for detailed information.

Threadpool Configuration

This property is used when there is a need to process messages in parallel within the component, still maintaining the sequence from the external perspective.

  • This needs to be used only in such circumstances.
  • If sequential processing is not required, please use sessions on the input port.

Click the Threadpool Configuration ellipses button to configure the Threadpool Configuration properties.


Figure 33: Threadpool Configuration properties

Enable Thread Pool

Enable this option to configure the properties that appear as below.

Pool Size

The number of requests to be processed in parallel within the component. Default value is '1'.

Batch Eviction Interval (in ms)

Time in milliseconds after which the threads are evicted in case of inactivity. New threads are created in place of evicted threads when new requests are received. Default value is '1000'.

Setting up local Dynamo DB

Apart from the Dynamo DB web service, Dynamo DB is available as a download which can be set up locally. Having this local version helps save on provisioned throughput, data storage, and data transfer fees. In addition, there is no need for an internet connection.

Please find the link below to download and set up Dynamo DB locally: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

To interact with local Dynamo DB, one can use command line interface; refer to these links:

  1. To install: https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html
  2. To configure CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html.

Once CLI is installed, the user can run commands to execute operations.

The list of available CLI commands is listed in the following link: https://docs.aws.amazon.com/cli/latest/reference/dynamodb/index.html

Example: To list all tables

The following string is used to override the command's default URL (which connects to the AWS instance) with the URL of local Dynamo DB.

Functional Demonstration

Configure the DynamoDB component with various operations as described in the component description and connect Feeder and Display components to send input and receive output respectively.


Figure 34: Event Process to demonstrate functions of DynamoDB

Below are some sample inputs sent  and outputs received for all of various operations.

Get operation

In this example, Price and Id are returned for the entry with primary key Id, the value of which is 205.

Input

Input text for Get operation

Output

Put operation

In this example, three attributes are given as input with id as the primary key.

The conditional expression attribute_not_exists(#id) is used to put the value only if the given ID value is not already present in the table.

Input

Input text for Put operation

 

Output

Update operation

In this example, the price value of the entry is updated with Id 201 to 12000, with "Bicycle" as the ProductCategory.

Input

Input text for Update operation

 

Output

Only the attribute whose value is updated is displayed.

Delete operation

In this example, delete operation is performed on the entry with Id Value as 102 and only if "Author1" is contained in Authors attribute.

Input

Input text for Delete operation

 

Output

The output is displayed as the contents of the entry before the Delete Operation was performed.

 

Query operation

In this operation, the entry with Id value 205 is returned subjected to the condition that the Price attribute has a value of 500(Given in the filter expression).

Input

Input text for Query operation

 

Output

Scan operation

In this example, the Bicycle Type and the Price of all the contents in the table are returned whose price lies between 0 and 499.

Input

Input text for Scan operation

 

Output

BatchGetItem operation

In this example, the get operation is performed on two tables namely ProductCatalog(for id = 204) and Forum (FName = Amazon S3).

Input

Input text for BatchGetItem operation

 

Output

BatchWriteItem operation

In this example, attribute at13 is inserted at Id 204 and the entry with Id=112 is deleted.

Input

Input text for BatchWriteItem operation

Output

Points to Note

Depending on the operation type, the following parameters are taken from the input. The rest of the parameters are taken from the CPS for processing.

  • Primary key values for Get Item, Delete Item, Update Item operations.
  • Exclusive start key values for Query and Scan operations.
  • Input attributes for Put Item which also includes primary key values.
  • Expression attribute values for Put Item, Update Item, Delete Item, Query, and Scan operations.

Output format for various operations.

  • GetItem: The JSON corresponding to the primary key specified will be sent to the output. If there is no matching item in Dynamo DB for the specified key then empty JSON object will be sent if the component is configured to send an empty response in such cases via Send empty response expert property.
  • PutItem/UpdateItem/DeleteItem: If the component is configured to return NONE via Return Values parameter in CPS, then a JSON object {“success” : true} will be sent to the output. In case of Return Values parameter set to a value other than NONE, the corresponding item will be sent if exists, otherwise {“success” : true} JSON object will be sent.
  • Query/Scan/BatchGetItem: The list of items will be sent as JSON objects to the output. Each JSON object is separated by a newline. If there are no items retrieve then empty JSON will be sent if the component is configured to send an empty response via Send empty response expert property.
  • BatchWriteItem: The output will be a JSON object which has information about Unprocessed items if any resulting out of the operation.
Adaptavist ThemeBuilder EngineAtlassian Confluence