Using Ops for dynamodb condition expressions

This commit is contained in:
Matthew Stevens 2019-04-01 16:48:00 -04:00 committed by Garrett Heel
commit 57b668c832
4 changed files with 58 additions and 31 deletions

View file

@ -1616,6 +1616,21 @@ def test_condition_expressions():
}
)
client.put_item(
TableName='test1',
Item={
'client': {'S': 'client1'},
'app': {'S': 'app1'},
'match': {'S': 'match'},
'existing': {'S': 'existing'},
},
ConditionExpression='attribute_exists(#nonexistent) OR attribute_exists(#existing)',
ExpressionAttributeNames={
'#nonexistent': 'nope',
'#existing': 'existing'
}
)
with assert_raises(client.exceptions.ConditionalCheckFailedException):
client.put_item(
TableName='test1',