Reputation: 125
I am trying to update a json response to an item in AWS DynamoDB and getting below error. Could someone please help on this
import boto3
import json
dynamoDB = boto3.client('dynamodb')
def lambda_handler(event, context):
testinfo = {"Smile":{"Confidence": '99.8970947265625',"Value":
"True"}}
dynamoDB.put_item(TableName='DetectedInfo',Item={'DateTime':
'12282018','Info': json.dumps(testinfo)})
Error:
ParamValidationError: Parameter validation failed: Invalid type for parameter Item.Info, value: [{"Smile": {"Confidence": "99.8970947265625", "Value": "True"}}], type: , valid types: Invalid type for parameter Item.DateTime, value: 12132018, type: , valid types:
Upvotes: 1
Views: 319
Reputation: 67988
It has to be of form:
dynamoDB.put_item(TableName='DetectedInfo',
Item={
'DateTime': {
'N':'12282018'},
'Info': {
'S':json.dumps(testinfo)}
})
Here N,S is the type of variable.You need to check allowed data types in aws documentation and apply accordingly.
Upvotes: 3