How do I put an item in a dynamodb table only if that item does not exist. So far, I have:
table.put_item(
Item:={
'greeting': 'hi'
},
ConditionExpression= 'attribute_not_exists(hi)'
)
What would my condition expression be?
It would be something like this:
ConditionExpression= "attribute_not_exists(Id)" // where id is your unique key
hi in attribute_not_exists to the name of your partition key attribute e.g. attribute_not_exists(greeting) assuming "greeting" is the name of the partition key