Is there a way to add custom metadata on DynamoDB when performing such operations as PutItem, Query, Scan, GetItem, etc.? Where I can add and read those metadata?
Example:
"sample-key": "sample-value"
I think the S3 has the Metadata
field on its UploadInput
. While the SQS has the MessageSystemAttributeValue
.
CodePudding user response:
This is not possible in DynamoDB like how you do it in S3 or SQS.
For DynamoDB, you simply need to add an attribute to the item when you put/update it, in this case I call the attribute metadata
:
Item={
'pk': '[email protected]',
'sk': 'engineer',
'username': 'joses',
'first_name': 'Jose',
'last_name': 'Schneller',
'name': 'Jose Schneller',
'age': 27,
'address': {
'road': '12341 Fish Rd',
'city': 'Freeland',
'pcode': 98249,
'state': 'WA',
'country': 'USA'
},
'metadata':{
'sample-key': 'sample-value'
}
}
This means you get the items metadata each time you read the item.