I am trying to update an entry in my DynamoDB Table via this piece of code below :
response = table.update_item(
Key={
"id": id, # Partition key
"timestamp": timestamp # Sort key
},
UpdateExpression='SET formattedEventTimestamp = :val',
ExpressionAttributeValues={':val': formatted_event_timestamp},
ReturnValues="UPDATED_NEW",
)
print(response)
I am getting this output
{'Attributes': {'formattedEventTimestamp': '2024-04-17T07:18:23.884Z'}, 'ResponseMetadata': {'RequestId': 'P9V786Q1PA7UHCBSTGEKT1L7CRVV4KQNSO5AEMVJF66Q9ASUAAJG', 'HTTPStatusCode': 200, 'HTTPHeaders': {'server': 'Server', 'date': 'Wed, 24 Apr 2024 07:34:43 GMT', 'content-type': 'application/x-amz-json-1.0', 'content-length': '75', 'connection': 'keep-alive', 'x-amzn-requestid': 'P9V786Q1PA7UHCBSTGEKT1L7CRVV4KQNSO5AEMVJF66Q9ASUAAJG', 'x-amz-crc32': '3823649721'}, 'RetryAttempts': 0}}
Although when I check the entry corresponding to the id : 6bea0421-27f8-4e0c-a264-fcdd870078a2
I don’t find formattedEventTimestamp field added to it.
Here’s how the entry looks like
{
"id": {
"S": "6bea0421-27f8-4e0c-a264-fcdd870078a2"
},
"timestamp": {
"N": "1712701935632"
},
"created_at": {
"S": "2024-04-09T22:32:15.632Z"
},
"eventTimestamp": {
"L": [
{
"N": "2024"
},
{
"N": "4"
},
{
"N": "9"
},
{
"N": "22"
},
{
"N": "32"
},
{
"N": "15"
},
{
"N": "384783746"
}
]
},
"eventType": {
"S": "BINDING_SUCCESS"
},
"pci": {
"S": "5d215c89-8883-4de6-aec5-7ff60d519f68"
}
}
How do I fix this issue ?
New contributor
Shivam Jadhav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.