Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

BatchWriteItem help #8

Open
gadget-man opened this issue Aug 6, 2018 · 0 comments
Open

BatchWriteItem help #8

gadget-man opened this issue Aug 6, 2018 · 0 comments

Comments

@gadget-man
Copy link

Hi,

Is anybody able to help me work out how to use BatchWriteItem on Arduino using the SDK? I've got putItem working fine, and from reading the library have worked out I need to change the following (currently shown with putItem as working, Batchwriteitem commented out:

In my header:
PutItemInput putItemInput; //BatchWriteItemInput batchWriteItemInput;
In the function:
`putItemInput.setItem(MinimalMap < AttributeValue > (itemArray, 4));
putItemInput.setTableName(TABLE_NAME);
// batchWriteItemInput.setRequestItems(MinimalMap<MinimalList > requestItems);

//perform putItem and check for errors.
PutItemOutput putItemOutput = ddbClient.putItem(putItemInput, actionError);
//BatchWriteItemOutput batchWriteItemOutput = ddbClient.batchWriteItem(batchWriteItemInput, actionError);`

For putItem, the library helps me create the necessary JSON for MinimalMap < AttributeValue > (itemArray, 4) using the following:
MinimalKeyValuePair < MinimalString, AttributeValue > att1(HASH_KEY_NAME, deviceValue); MinimalKeyValuePair < MinimalString, AttributeValue > att2(RANGE_KEY_NAME, timeValue); MinimalKeyValuePair < MinimalString, AttributeValue > att3(CATEGORY_KEY_NAME, categoryValue); MinimalKeyValuePair < MinimalString, AttributeValue > att4(DEBUG_KEY_NAME, debugValue); MinimalKeyValuePair < MinimalString, AttributeValue> itemArray[] = { att1, att2, att3, att4 };

What I can't get my head around is how to use something similar within a loop to create the MinimalMap<MinimalList > requestItems needed for batchWriteItem.

I'm learning everything as I go with the power of google, so don't really know what I'm doing - if anyone can point me in the right direction it would be much appreciated - would be great to be able to share a working BatchWriteItem example here for others.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant