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

BatchWriteItem help #8

Open
Open
@gadget-man

Description

@gadget-man

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions