我得到了AttributeError:';str';对象没有属性';查询';用python

我得到了AttributeError:';str';对象没有属性';查询';用python,python,boto3,Python,Boto3,我尝试将主键及其值作为用户输入,并尝试对此进行查询,但出现以下错误: “str”对象没有“query”属性 将只返回表的名称,而不是表本身。您必须先打开表,然后打开表上的query()。source\u table=raw\u input()。。。那总是一个str。。。您试图对哪个对象运行query()? source_table = raw_input("Enter the table name : ") source_table = raw_input("Enter the table n

我尝试将主键及其值作为用户输入,并尝试对此进行查询,但出现以下错误:

“str”对象没有“query”属性


将只返回表的名称,而不是表本身。您必须先打开表,然后打开表上的
query()

source\u table=raw\u input()
。。。那总是一个
str
。。。您试图对哪个对象运行
query()
source_table = raw_input("Enter the table name : ")
source_table = raw_input("Enter the table name : ")
source_table = raw_input("Enter the table name : ")
PK = raw_input("Enter the primary key : ")
PriKeyData = raw_input("Enter the data type for Primary key int-number, str-string :" )
dynamodb = boto3.resource('dynamodb')
s_table = dynamodb.Table(source_table.format(**locals()))
with open('PriSortKeys.csv', 'rb') as csvfile:
    csvreader = csv.reader(csvfile, delimiter='\t', quotechar='|')
    for row in csvreader:
        if PriKeyData == "int":
                prikeyvalue = int(row[0])
            else:
                prikeyvalue = str(row[0])
        logger.info("Checking for Key :" + str(prikeyvalue))
        ## Fetching data from table based on primarykey
        s_table = source_table.query(KeyConditionExpression=Key(PK).eq(prikeyvalue))