Trying to do an update_item which is supposed to create new attributes if it doesn't find existing ones (according to documentation) but I am getting a Sytax error.
I have been wracking my brain all day trying to figure out why I am getting this and I can't seem to get past this. Thank you for any help
Error I am getting:
ClientError: An error occurred (ValidationException) when calling the UpdateItem operation:
ExpressionAttributeValues contains invalid key: Syntax error; key: "var4"
MyCode:
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('contacts')
table.update_item(
Key={'email': emailID},
UpdateExpression=SET last_name = :var0, address_1_state = :var1, email_2 = :var2, phone = :var3, phone_2 = :var4
ExpressionAttributeValues={
'var0': 'Metzger',
'var1': 'CA',
'var2': 'none',
'var3': '949 302-9072',
'var4': '818-222-2311'
}
)
just change the section like the following -
ExpressionAttributeValues={
':var0': 'Metzger',
':var1': 'CA',
':var2': 'none',
':var3': '949 302-9072',
':var4': '818-222-2311'
}
Hope the code will work then :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With