即使使用python在Dynomodb中存在表,也会获得ResourceNotFoundException

时间:2017-10-27 04:41:09

标签: python amazon-dynamodb

我能够访问该区域并能够获取可用的表但是当我在现有表上执行get_item方法时它返回ResourceNotFoundException(未找到资源),请查看下面的代码并帮助我。感谢

import argparse
import boto3
import boto
import boto.dynamodb

def remove():
    conn = boto.dynamodb.connect_to_region(
        'us-west-2',
        aws_access_key_id='<key_id>',
        aws_secret_access_key='<secret-key>')

    res = conn.list_tables();
    print(res) #listed all tables 
    dynamodb = boto3.resource('dynamodb')
    table = dynamodb.Table('<table-name>')
    des = conn.describe_table('<table-name>')
    print(des) . # describing the table 
    response = table.get_item(
            Key={
            'id': '<id>'
         }
    )   
    item = response['Item']
    print(item)

0 个答案:

没有答案