Skip to content

DynamoDB

myna supports common DynamoDB operations for managing data.

  • dynamodb.list_tables
  • dynamodb.put_item
  • dynamodb.get_item
  • dynamodb.update_item
  • dynamodb.delete_item
  • dynamodb.query
  • dynamodb.scan

Returns an array of table names associated with the current account and endpoint.

version = "1.0"
kind = "dynamodb.list_tables"

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

FieldTypeRequiredDescription
table_namestringYesThe name of the table to contain the item.
condition_expressionstringNoA condition that must be satisfied in order for a conditional PutItem operation to succeed.

The item to put is taken from the [payload] block (either data or file). The payload should be a standard JSON object. The tool handles the conversion to DynamoDB JSON format.

version = "1.0"
kind = "dynamodb.put_item"
[dynamodb]
table_name = "Users"
[payload]
data = """
{
"UserId": "user-123",
"Name": "Alice",
"Age": 30,
"Active": true
}
"""

The GetItem operation returns a set of attributes for the item with the given primary key.

FieldTypeRequiredDescription
table_namestringYesThe name of the table containing the requested item.
keymapYesA map representing the primary key of the item to retrieve.
consistent_readboolNoDetermines the read consistency model: If set to true, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
version = "1.0"
kind = "dynamodb.get_item"
[dynamodb]
table_name = "Users"
key = { "UserId" = "user-123" }

Deletes a single item in a table by primary key.

FieldTypeRequiredDescription
table_namestringYesThe name of the table from which to delete the item.
keymapYesA map representing the primary key of the item to delete.
condition_expressionstringNoA condition that must be satisfied in order for a conditional DeleteItem to succeed.
version = "1.0"
kind = "dynamodb.delete_item"
[dynamodb]
table_name = "Users"
key = { "UserId" = "user-123" }

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

FieldTypeRequiredDescription
table_namestringYesThe name of the table.
keymapYesThe primary key of the item to be updated.
update_expressionstringNoAn expression that defines one or more attributes to be updated, action to be performed, and new value(s).
condition_expressionstringNoA condition that must be satisfied in order for a conditional update to succeed.
expression_attribute_namesmapNoSubstitution tokens for attribute names in an expression.
expression_attribute_valuesmapNoSubstitution tokens for attribute values in an expression.
version = "1.0"
kind = "dynamodb.update_item"
[dynamodb]
table_name = "Users"
key = { "UserId" = "user-123" }
update_expression = "SET Age = :newAge"
expression_attribute_values = { ":newAge" = 31 }

The Query operation finds items based on primary key values.

FieldTypeRequiredDescription
table_namestringYesThe name of the table.
key_condition_expressionstringYesThe condition that specifies the key values for items to be retrieved.
expression_attribute_valuesmapNoSubstitution tokens for attribute values.
index_namestringNoThe name of an index to query.
limitintNoThe maximum number of items to evaluate (not necessarily the number of matching items).
version = "1.0"
kind = "dynamodb.query"
[dynamodb]
table_name = "Orders"
key_condition_expression = "OrderId = :oid"
expression_attribute_values = { ":oid" = "ord-555" }

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

FieldTypeRequiredDescription
table_namestringYesThe name of the table.
filter_expressionstringNoA string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you.
expression_attribute_valuesmapNoSubstitution tokens for attribute values.
limitintNoThe maximum number of items to evaluate.
version = "1.0"
kind = "dynamodb.scan"
[dynamodb]
table_name = "Users"
limit = 10