我试着在实际添加新项之前,让put-item检查是否有具有相同HashKey的项。在
根据boto DynamoDB2文档,使用“条件Put”是可能的。在
我试着听从命令,但运气不佳。在
connection.put_item('table',item={'locationId':'a1', 'timestamp': time.time()}, expected={'locationID':False})
错误消息如下。在
^{pr2}$
有没有人对DynamoDBv2有条件的put?在
感谢大家的提前。在
Tags:
你需要这样写才能让语法工作。非常糟糕的是,这在任何地方都没有记录。我只是遇到了完全相同的问题,在翻阅javasdk文档时,我不得不尝试50种不同的方法。请注意,如果要使用
'Exists': True
而不是False
,则需要给出一个值。在希望有帮助!在
编辑:the question that helped me with the syntax enough to make it work和code in the boto integration tests
注意,
put_item
的参数expected
现在是deprecated:使用
condition_expression
代替:也可以链接表达式和使用命名参数,例如:
^{pr2}$See Performing Conditional Writes with Condition Expressions for more details。在
相关问题 更多 >
编程相关推荐