Feb. 5, 2024, 3:16 a.m. | Abhishek Gupta

DEV Community dev.to

Posted: 5/Feb/2024


You can club multiple (up to 100) GetItem requests in a single BatchGetItem operation - this can be done across multiple tables.


Here is an example that fetches includes four GetItem calls across two different tables:



    resp, err := client.BatchGetItem(context.Background(), &dynamodb.BatchGetItemInput{
RequestItems: map[string]types.KeysAndAttributes{
"customer": types.KeysAndAttributes{
Keys: []map[string]types.AttributeValue{
{
"email": &types.AttributeValueMemberS{Value: "c1@foo.com"},
},
{
"email": &types.AttributeValueMemberS{Value: "c2@foo.com"},
},
},
},
"Thread": types.KeysAndAttributes{
Keys: []map[string]types.AttributeValue{
{
"ForumName": &types.AttributeValueMemberS{Value: "Amazon DynamoDB"},
"Subject": &types.AttributeValueMemberS{Value: "DynamoDB Thread 1"},
},
{
"ForumName": &types.AttributeValueMemberS{Value: "Amazon …

amp can client cloud club context customer database dynamodb email keys map requests serverless single tables types

CyberSOC Technical Lead

@ Integrity360 | Sandyford, Dublin, Ireland

Cyber Security Strategy Consultant

@ Capco | New York City

Cyber Security Senior Consultant

@ Capco | Chicago, IL

Sr. Product Manager

@ MixMode | Remote, US

Corporate Intern - Information Security (Year Round)

@ Associated Bank | US WI Remote

Senior Offensive Security Engineer

@ CoStar Group | US-DC Washington, DC