Multi-Operation Requests

One of Dynomate's most powerful features is its ability to chain multiple DynamoDB operations together in a single request. This allows you to create complex workflows that would otherwise require custom code or multiple separate requests.

What are Multi-Operation Requests?

Multi-operation requests allow you to execute a sequence of DynamoDB operations in a single workflow. Each operation can use the results of previous operations as input, making it possible to create sophisticated data flows directly in the Dynomate interface.

Creating a Request

To create a new multi-operation request:

  1. Navigate to the "Requests" or "Collections" panel in the Dynomate interface
  2. Click the "New Request" or "+" button to create a new request
  3. Give your request a descriptive name

Organizing Requests

Consider organizing your requests into collections based on function or purpose. For example, you might have collections for "User Management", "Inventory Queries", or "Reporting".

Adding Operations

Each request can contain multiple DynamoDB operations. To add an operation:

  1. In your request, click the "Add Operation" button
  2. Select the operation type (Query, Scan, GetItem, PutItem, UpdateItem, DeleteItem)
  3. Configure the operation settings:

Query

  • Select the AWS profile and table
  • Specify the partition key and (optionally) sort key condition
  • Add any filter expressions
  • Set limits, consistent read options, etc.

Scan

  • Select the AWS profile and table
  • Add filter expressions if needed
  • Set limits and other scan options

GetItem

  • Select the AWS profile and table
  • Specify the primary key (partition and sort key if applicable)

PutItem / UpdateItem / DeleteItem

  • Select the AWS profile and table
  • Specify the primary key
  • For PutItem and UpdateItem, provide the item data or update expressions

You can add as many operations as needed, and they will be executed in sequence when you run the request.

Referencing Previous Operations

The real power of multi-operation requests comes from the ability to reference the results of previous operations in subsequent operations. This allows you to create dynamic workflows that would otherwise require custom code.

Reference Syntax

To reference a value from a previous operation, use the following syntax:

Reference Syntax
${operation_name.path.to.value}

Where:

  • operation_name is the name of the previous operation
  • path.to.value is the path to the value in the result object

Example: User and Orders

Here's a common example of using operation references:

1

Get User by Email

First operation (name: getUser): Query the Users table to find a user by email

{ 
  "operation": "query",
  "table": "Users",
  "keyCondition": "email = :email",
  "expressionValues": {
    ":email": "user@example.com"
  }
}
2

Get User's Orders

Second operation (name: getUserOrders): Query the Orders table using the user ID from the first operation

{
  "operation": "query",
  "table": "Orders",
  "keyCondition": "userId = :userId",
  "expressionValues": {
    ":userId": "${get_user.items[0].userId}"
  }
}

Common Reference Patterns

Here are some common patterns for referencing values:

  • ${operation.items[0].attribute} - First item's attribute from a Query/Scan result
  • ${operation.item.attribute} - Attribute from a GetItem result
  • ${operation.items.length} - Count of items returned by a Query/Scan

Request Logs

As your multi-operation requests execute, Dynomate provides detailed logs of each operation, including:

  • The raw request data sent to DynamoDB
  • Any parameters used (like keys, filters, or expression attributes)
  • The results returned from DynamoDB
  • Timing information for each operation

These logs are invaluable for debugging complex requests and understanding exactly what data is being sent to and received from DynamoDB.

Saving Requests

Once you've created a multi-operation request, you can save it for future use:

  1. Click the "Save" button in the request editor
  2. Choose a collection to save the request in (or create a new collection)
  3. Optionally add a description or tags to help organize your requests

Version Control Integration

Saved requests are stored as JSON files on your local machine. This makes it easy to:

  • Commit your requests to Git or other version control systems
  • Share requests with team members
  • Track changes to your requests over time

Advanced Examples

Data Migration Flow

This example shows how to create a multi-operation request that migrates data from one table to another, with transformation:

Data Migration Flow
// Operation 1: Get source data
{
  "name": "getSourceData",
  "operation": "scan",
  "table": "OldUsers",
  "limit": 10
}

// Operation 2: Transform and insert into new table
{
  "name": "transformAndInsert",
  "operation": "batchWrite",
  "table": "NewUsers",
  "items": [
    "#each get_source_data.items as |user|": {
      "newId": "${user.id}",
      "fullName": "${user.firstName} ${user.lastName}",
      "email": "${user.email}",
      "createdAt": "2025-05-01T09:37:39.522Z"
    }
  ]
}

Conditional Update Chain

This example demonstrates a conditional update that only executes if certain conditions are met:

Conditional Update Chain
// Operation 1: Check item status
{
  "name": "checkItem",
  "operation": "getItem",
  "table": "Orders",
  "key": { "orderId": "order-123" }
}

// Operation 2: Update if status is "pending"
{
  "name": "updateIfPending",
  "operation": "updateItem",
  "table": "Orders",
  "key": { "orderId": "order-123" },
  "updateExpression": "SET status = :newStatus, updatedAt = :timestamp",
  "conditionExpression": "status = :pendingStatus",
  "expressionValues": {
    ":newStatus": "processing",
    ":timestamp": "${new Date().toISOString()}",
    ":pendingStatus": "pending"
  },
  "skip": "${check_item.item.status !== 'pending'}"
}