Python 使用属性\u获取table.query时Boto DynamoDB错误

Python 使用属性\u获取table.query时Boto DynamoDB错误,python,boto,amazon-dynamodb,Python,Boto,Amazon Dynamodb,我已经用字符串散列键和范围键建立了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@asd

我已经用字符串散列键和范围键建立了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', 'user_id', 'session_time'], request_limit=5)
>>> [i for i in x]
[{u'session_time': u'2012/04/18 09:59:20.247 -0400', u'user_id': u'asdf@asdf.com', 
    u'x-start-time': u'2012/04/18 09:59:20.247 -0400'}, ...
这没有,我也不明白为什么没有:

>>> 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
>x=table.query(hash\u key=)asdf@asdf.com,range_key_condition=以“20”开头,
属性_to_get=[u'x-start-time'],请求_限制=5)
>>>[i代表x中的i]
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site packages/boto-2.3.0-py2.7.egg/boto/dynamodb/layer2.py”,第588行,在查询中
收益项目\类别(表,属性=项目)
文件“/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/site packages/boto-2.3.0-py2.7.egg/boto/dynamodb/item.py”,第45行,在__
raise DynamoDBItemError('必须提供散列密钥')
boto.dynamodb.exceptions.DynamoDBItemError:BotoClientError:您必须提供散列密钥
这对我来说没什么意义。我显然提供了一个散列键。我无法通过查看Boto来源来判断问题是什么。有问题的属性肯定存在于每个记录中(而不是应该抛出错误的记录)


有什么建议吗?谢谢

在一位同事的帮助下,我们解决了这个问题。问题是
attributes\u to\u get
需要散列键和范围键的名称。因此,这是可行的:

>>> 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', 'user_id', 'session_time'], request_limit=5)
>>> [i for i in x]
[{u'session_time': u'2012/04/18 09:59:20.247 -0400', u'user_id': u'asdf@asdf.com', 
    u'x-start-time': u'2012/04/18 09:59:20.247 -0400'}, ...

对我来说,这似乎是一个(次要的)Boto问题…

在一位同事的帮助下,我们解决了这个问题。问题是
attributes\u to\u get
需要散列键和范围键的名称。因此,这是可行的:

>>> 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', 'user_id', 'session_time'], request_limit=5)
>>> [i for i in x]
[{u'session_time': u'2012/04/18 09:59:20.247 -0400', u'user_id': u'asdf@asdf.com', 
    u'x-start-time': u'2012/04/18 09:59:20.247 -0400'}, ...

对我来说,这似乎是一个(次要的)Boto问题…

巧合的是,今天早些时候,Boto刚刚解决了这个问题。见:


巧合的是,今天早些时候boto刚刚修复了这个问题。见:

巧合的是!巧合的是!