python 2.7 - Why this dynamodb query failed with 'Requested resource not found'? -


i have doubled checked item exists in dynamodb table. id default hash key.

enter image description here

i want retrieve content using main function in code:

import boto.dynamodb2 boto.dynamodb2 import table  table='doc' region='us-west-2' aws_access_key_id='yyy' aws_secret_access_key='xxx'  def get_db_conn():   return boto.dynamodb2.connect_to_region(             region,             aws_access_key_id=aws_access_key_id,             aws_secret_access_key=aws_secret_access_key)  def get_table():   return table.table(table, get_db_conn())  def main():   tbl = get_table()   doc = tbl.get_item(id='4d7a73b6-2121-46c8-8fc2-54cd4ceb2a30')   print doc.keys() 

however exception instead:

  file "scripts/support/find_doc.py", line 31, in <module>     main()   file "scripts/support/find_doc.py", line 33, in main     doc = tbl.get_item(id='4d7a73b6-2121-46c8-8fc2-54cd4ceb2a30')   file "/users/antkong/project-ve/lib/python2.7/site-packages/boto/dynamodb2/table.py", line 504, in get_item     consistent_read=consistent   file "/users/antkong/project-ve/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 1065, in get_item     body=json.dumps(params))   file "/users/antkong/project-ve/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 2731, in make_request     retry_handler=self._retry_handler)   file "/users/antkong/project-ve/lib/python2.7/site-packages/boto/connection.py", line 953, in _mexe     status = retry_handler(response, i, next_sleep)   file "/users/antkong/project-ve/lib/python2.7/site-packages/boto/dynamodb2/layer1.py", line 2774, in _retry_handler     data) boto.exception.jsonresponseerror: jsonresponseerror: 400 bad request {u'message': u'requested resource not found', u'__type': u'com.amazonaws.dynamodb.v20120810#resourcenotfoundexception'} 

why getting error message?

i using boto version 2.34

if have range key have specify in get_item, so:

get_item(timestamp=decimal('1444232509'), id='hash_sha1') 

here on table packages have index (id) , range key (timestamp).


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -