I'm trying to update an item on a dynamodb, however i don't want it to create a new item if it doesnt exist. I've tried:
dynamodb = boto3.client('dynamodb')
element = 'test'
dynamodb.update_item(
TableName='myTable',
Key={
'serial':{
'S':element
}
},
AttributeUpdates={
'total':{
'Value':{
'N':'0'
},
'Action':'PUT'
}
},
UpdateExpression ='serial= :serial',
ExpressionAttributeNames={
':serial':'VM1'
}
)
But i get this error:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the UpdateItem operation: Can not use both expression and non-expression parameters in the same request: Non-expression parameters: {AttributeUpdates} Expression parameters: {UpdateExpression}