☁️ 6.3 DynamoDB

MATLAB client for Amazon DynamoDB. Create tables, perform CRUD operations, and use waiters for table state.

ddb = aws.dynamodb.Client();

🔧 6.3.1 List of Available Methods

🧩 6.3.2 Examples

Create a table (simplified)

ddb = aws.dynamodb.Client();

keySchema = aws.dynamodb.model.KeySchemaElement(name="id", keyType="HASH");
attrDef   = aws.dynamodb.model.AttributeDefinition(attributeName="id", attributeType="S");
thruput   = aws.dynamodb.model.ProvisionedThroughput(readCapacityUnits=int64(5), writeCapacityUnits=int64(5));

ct = ddb.createTable(tableName="matlab-demo", keySchema=keySchema, attributeDefinitions=attrDef, provisionedThroughput=thruput);

Put and get an item

item = dictionary;
item("id")   = aws.dynamodb.model.AttributeValue.s("123");
item("name") = aws.dynamodb.model.AttributeValue.s("Alice");
ddb.putItem(tableName="matlab-demo", item=item);

key = dictionary("id", aws.dynamodb.model.AttributeValue.s("123"));
gr = ddb.getItem(tableName="matlab-demo", key=key);

📘 6.3.3 Method Reference (Summary)

🔸 createTable

ct = ddb.createTable(tableName="<name>", keySchema=<KeySchemaElement>, attributeDefinitions=<AttributeDefinition>, provisionedThroughput=<ProvisionedThroughput>);
  • Returns: aws.dynamodb.model.CreateTableResponse

🔸 deleteTable

ddb.deleteTable(tableName="<name>");
  • Returns: aws.dynamodb.model.DeleteTableResponse

🔸 describeTable

dt = ddb.describeTable(tableName="<name>");
  • Returns: aws.dynamodb.model.DescribeTableResponse

🔸 listTables

lt = ddb.listTables();
  • Returns: aws.dynamodb.model.ListTablesResponse

🔸 putItem

ddb.putItem(tableName="<name>", item=<dictionary>);
  • Returns: aws.dynamodb.model.PutItemResponse

🔸 getItem

gr = ddb.getItem(tableName="<name>", key=<dictionary>);
  • Returns: aws.dynamodb.model.GetItemResponse

🔸 updateItem

ur = ddb.updateItem(tableName="<name>", key=<dictionary>, updateExpression="SET #n = :v", expressionAttributeNames=dictionary("#n","name"), expressionAttributeValues=dictionary(":v", aws.dynamodb.model.AttributeValue.s("Bob")));
  • Returns: aws.dynamodb.model.UpdateItemResponse

🔸 deleteItem

ddb.deleteItem(tableName="<name>", key=<dictionary>);
  • Returns: aws.dynamodb.model.DeleteItemResponse

🔸 query

qr = ddb.query(tableName="<name>", keyConditionExpression="id = :id", expressionAttributeValues=dictionary(":id", aws.dynamodb.model.AttributeValue.s("123")));
  • Returns: aws.dynamodb.model.QueryResponse

🔸 batchWriteItem

bwr = ddb.batchWriteItem(requestItems=<dictionary>);
  • Returns: aws.dynamodb.model.BatchWriteItemResponse

See also

🔗 Data Models: TableDescription, AttributeDefinition, KeySchemaElement, ProvisionedThroughput, AttributeValue, PutItemResponse, GetItemResponse, QueryResponse, UpdateItemResponse, DeleteItemResponse, BatchWriteItemResponse, DescribeTableResponse, ListTablesResponse