擅长:python、mysql、java
<p>你需要这样写才能让语法工作。非常糟糕的是,这在任何地方都没有记录。我只是遇到了完全相同的问题,在翻阅javasdk文档时,我不得不尝试50种不同的方法。请注意,如果要使用<code>'Exists': True</code>而不是<code>False</code>,则需要给出一个值。在</p>
<pre><code>connection.put_item(
'table',
item={
'locationId':{'S': 'a1'},
'timestamp': {'N': str(time.time())
},
expected={
'locationID': {'Exists': False}
}
#expected={
# 'locationID': {'Exists': True, 'Value': {'N': '0'}}
#}
)
</code></pre>
<p>希望有帮助!在</p>
<p>编辑:<a href="https://stackoverflow.com/a/10338191/268939">the question that helped me with the syntax enough to make it work</a>和<a href="https://github.com/boto/boto/blob/develop/tests/integration/dynamodb2/test_layer1.py#L270-L277" rel="nofollow noreferrer">code in the boto integration tests</a></p>