-1
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 :")
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
sourcetable_data= source_table.query(KeyConditionExpression=Key(PK).eq(prikeyvalue))
我想把主键和它的值作为用户输入并试图查询,但我得到以下错误:我越来越AttributeError:'str'对象在python中没有属性'查询'
'str' object has no attribute 'query'
'source_table = raw_input()'...那总是一个'str' ...你试图运行query()对什么对象? –