Merge pull request #711 from skygeo/fix_dynamodb2_conditions
fix: dynamodb2 conditions
This commit is contained in:
commit
f7ea66c248
2 changed files with 40 additions and 2 deletions
|
|
@ -275,9 +275,14 @@ class Table(object):
|
|||
raise ValueError("The conditional request failed")
|
||||
elif key not in current_attr:
|
||||
raise ValueError("The conditional request failed")
|
||||
elif DynamoType(val['Value']).value != current_attr[key].value:
|
||||
elif 'Value' in val and DynamoType(val['Value']).value != current_attr[key].value:
|
||||
raise ValueError("The conditional request failed")
|
||||
|
||||
elif 'ComparisonOperator' in val:
|
||||
comparison_func = get_comparison_func(val['ComparisonOperator'])
|
||||
dynamo_types = [DynamoType(ele) for ele in val["AttributeValueList"]]
|
||||
for t in dynamo_types:
|
||||
if not comparison_func(current_attr[key].value, t.value):
|
||||
raise ValueError('The conditional request failed')
|
||||
if range_value:
|
||||
self.items[hash_value][range_value] = item
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue