I am creating a dynamodb table via CDK.
const table = new dynamodb.Table(this, "my-table", {
tableName: StackConfiguration.tableName,
partitionKey: { name: "file_id", type: dynamodb.AttributeType.STRING },
});
dynamoReplayTable.addGlobalSecondaryIndex({
indexName: "processed",
# ideally would like boolean here but doesn't seem to be an option
partitionKey: { name: "processed", type: dynamodb.AttributeType.STRING },
});
Then using boto 3 i am inserting data into the table like so
failedRecord = {
"file_id": str(file_id),
"processed": "false",
"payload": str(payload),
"headers": str(headers),
}
table.put_item(Item=failedRecord)
I then have another service that reads the items, processes then and i want to update the processed field which is a global secondary index to true.
I have this code at the minute
table.update_item(
Key={"file_id": file_id}, AttributeUpdates={"processed": "true"},
)
But this results in the following error
Parameter validation failed:
Invalid type for parameter AttributeUpdates.processed, value: true, type: <class 'str'>, valid types: <class 'dict'>