我已经使用字符串哈希键和范围键设置了 DynamoDB 数据库。这有效:
>>> x = table.query(hash_key='asdf@asdf.com', range_key_condition=BEGINS_WITH("20"),
request_limit=5)
>>> [i for i in x]
[{u'x-entry-page': ...
这没有,我不知道为什么不:
>>> x = table.query(hash_key='asdf@asdf.com', range_key_condition=BEGINS_WITH("20"),
attributes_to_get=[u'x-start-time'], request_limit=5)
>>> [i for i in x]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/boto-2.3.0-py2.7.egg/boto/dynamodb/layer2.py", line 588, in query
yield item_class(table, attrs=item)
File "/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site-packages/boto-2.3.0-py2.7.egg/boto/dynamodb/item.py", line 45, in __init__
raise DynamoDBItemError('You must supply a hash_key')
boto.dynamodb.exceptions.DynamoDBItemError: BotoClientError: You must supply a hash_key
这对我来说意义不大。我显然提供了一个哈希键。我无法仅通过查看 Boto 源来判断问题所在。有问题的属性肯定存在于每条记录中(而不是应该引发错误)。
有什么建议么?谢谢!