Building Complex Operations - Amazon DynamoDB

Building Complex Operations

The operation builder in NoSQL Workbench for Amazon DynamoDB provides a visual interface where you can perform complex data plane operations. It includes support for projection expressions and condition expressions. You can also choose to generate sample code for these operations, in multiple languages.

To build DynamoDB operations

  1. In NoSQL Workbench, in the navigation pane on the left side, choose the Operation builder icon.

    
                        Console screenshot showing the operation builder icon.
  2. Choose Build operations, and then choose the operation that you want.

    
                Console screenshot showing the build operations button.

You can perform the following operations in the operation builder.

Put Item

To execute or generate code for a Put Item operation, do the following.

  1. Specify the partition key value.

  2. Specify the sort key value, if one exists.

  3. If you want to add non-key attributes, do the following:

    1. Choose the + (plus sign) next to Other attributes.

    2. Specify the Attribute name, Type, and Value.

  4. If a condition expression must be satisfied for the Put Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition Expressions.

    
                            Console screenshot showing the putitem operation
                                builder.
  5. If you want to generate code, choose Generate code.

    Select your desired language from the displayed tabs. You can now copy this code and use it in your application.

    
                            Console screenshot showing the generated code for putitem in
                                several languages.
  6. If you want the operation to be executed immediately, choose Execute.

For more information about this operation, see PutItem in the Amazon DynamoDB API Reference.

Update Item

To execute or generate code for an Update Item operation, do the following:

  1. Enter the partition key value.

  2. Enter the sort key value, if one exists.

  3. In Update expression, choose the expression in the list.

  4. Choose the + (plus sign) for the expression.

  5. Enter the attribute name and attribute value for the selected expression.

  6. If you want to add more expressions, choose another expression in the Update Expression drop-down list, and then select the +.

  7. If a condition expression must be satisfied for the Update Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition Expressions.

    
                            Console screenshot showing the updateitem operation
                                builder.
  8. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

    
                            Console screenshot showing the generated code for updateitem in
                                several languages.
  9. If you want the operation to be executed immediately, choose Execute.

For more information about this operation, see UpdateItem in the Amazon DynamoDB API Reference.

Delete Item

To execute or generate code for a Delete Item operation, do the following.

  1. Enter the partition key value.

  2. Enter the sort key value, if one exists.

  3. If a condition expression must be satisfied for the Delete Item operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition Expressions.

    
                            Console screenshot showing the deleteitem operation
                                builder.
  4. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

    
                            Console screenshot showing the generated code for deleteitem in
                                several languages.
  5. If you want the operation to be executed immediately, choose Execute.

For more information about this operation, see DeleteItem in the Amazon DynamoDB API Reference.

Query

To execute or generate code for a Query operation, do the following.

  1. Specify the partition key value.

  2. If a sort key is needed for the Query operation:

    1. Select Sort key.

    2. Specify the comparison operator, attribute type, and attribute value.

  3. If not all the attributes should be returned with the operation result, select Projection expression.

  4. Choose the + (plus sign).

  5. Enter the attribute to return with the query result.

  6. If more attributes are needed, choose the + .

  7. If a condition expression must be satisfied for the Query operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Conditionagain.

    For more information, see Condition Expressions.

    
                            Console screenshot showing the query operation builder.
  8. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

    
                            Console screenshot showing the generated code in several
                                languages in query operation builder.
  9. If you want the operation to be executed immediately, choose Execute.

For more information about this operation, see Query in the Amazon DynamoDB API Reference.

Scan

To execute or generate code for a Scan operation, do the following.

  1. If not all the attributes should be returned with the operation result, select Projection expression.

  2. Choose the + (plus sign).

  3. Specify the attribute to return with the query result.

  4. If more attributes are needed, choose the + again.

  5. If a condition expression must be satisfied for the scan operation to succeed, do the following:

    1. Choose Condition.

    2. Specify the attribute name, comparison operator, attribute type, and attribute value.

    3. If other conditions are needed, choose Condition again.

    For more information, see Condition Expressions.

    
                            Console screenshot showing the generated code in several
                                languages for the scan operation.
  6. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

  7. If you want the operation to be executed immediately, choose Execute.

TransactWriteItems

To execute or generate code for a TransactWriteItems operation, do the following.

  1. In the Actions drop-down list, choose the operation that you want.

    • For DeleteItem, follow the instructions for the Delete Item operation.

    • For PutItem, follow the instructions for the Put Item operation.

    • For UpdateItem, follow the instructions for the Update Item operation.

    When you are done specifying the details of the operation, choose the + button.

    
                            Console screenshot showing the plus sign button in
                                transactwriteitems operation builder.

    To change the order of actions, choose an action in the list on the left side, and then choose the up or down arrows to move it up or down in the list.

    To delete an action, choose the action in the list, and then choose the Delete (trash can) icon.

    
                            Console screenshot showing the up and down arrows and trash can
                                buttons in operation builder.
  2. If you want to generate code, choose Generate code.

    Choose the tab for the language that you want. You can now copy this code and use it in your application.

    
                            Console screenshot showing the generated code in several
                                languages.
  3. If you want the operation to be executed immediately, choose Execute.

For more information about transactions, see Amazon DynamoDB Transactions.