我試圖使用掃描功能如下,以從表中檢索任何10個結果在我的數據庫:DynamoDB掃描函數返回正確的結果,但與DynamoDBResponseError
conn = boto.connect_dynamodb(
aws_access_key_id=config.AWS_KEY,
aws_secret_access_key=config.AWS_SECRET)
table = conn.get_table('tablename')
results = table.scan(attributes_to_get={'id'},
max_results=10)
for item in results:
print item
./dbtest.py
{'id': 'SkAJWDUZPSNrwepf7gdnFhExXPFABmqLjk1ADDRJuoo'}
{'id': 'RjAVvd4SAmjtUbXEYmzBaIIDuruL5UZWEQPdcpj4XRc'}
...
但後來我在得到這個錯誤結束後(返回正確的結果後):
Traceback (most recent call last):
File "./mediatest.py", line 23, in <module>
for item in results:
File "/usr/lib/python2.7/dist-packages/boto/dynamodb/layer2.py", line 767, in scan
object_hook=item_object_hook)
File "/usr/lib/python2.7/dist-packages/boto/dynamodb/layer1.py", line 521, in scan
return self.make_request('Scan', json_input, object_hook=object_hook)
File "/usr/lib/python2.7/dist-packages/boto/dynamodb/layer1.py", line 121, in make_request
retry_handler=self._retry_handler)
File "/usr/lib/python2.7/dist-packages/boto/connection.py", line 746, in _mexe
status = retry_handler(response, i, next_sleep)
File "/usr/lib/python2.7/dist-packages/boto/dynamodb/layer1.py", line 148, in _retry_handler
json_response)
boto.exception.DynamoDBResponseError: DynamoDBResponseError: 400 Bad Request
{'Message': 'Expected null', '__type': 'com.amazon.coral.service#SerializationException'}
我不處理需要處理的東西嗎?
是什麼你博託版本? (''boto .__ version__'') – yadutaf
我正在運行2.5.2。即使我刪除了attributes_to_get變量,我也會得到這個錯誤 – ensnare
db.layer1.region.name和db.layer1.Version是怎麼回事? – yadutaf