文字列ハッシュ キーと範囲キーを使用して 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 のソースを見るだけでは、何が問題なのかわかりません。問題の属性は、すべてのレコードに確実に存在します (エラーをスローする必要はありません)。
助言がありますか?ありがとう!