mysql - Learning PyMySQL, Python - Tuple Error -
mysql - Learning PyMySQL, Python - Tuple Error -
i'm learning sql , trying build script update db basic company information.
below query i've got , i'm getting
query:
query = "update companies set url = '{}', industry = '{}', address = '{}', city = '{}', state = '{}', country = '{}', type = '{}', year_founded = {} name = '{}') values (\'{}\',{},\'{}\',\'{}\',\'{}\',\'{}\',\'{}\',{},\'{}\')".format(url,industry,address,city,state,country,type,year_founded,company_name)
error:
indexerror: tuple index out of range
indices:
insert1(company,url,data[1],data[3],data[4],data[5],data[7],data[0],data[9])
questions:
is there more elegant way build query? is possible setquery
onto multiple lines? what's best way that? i know that index goes 11 values should in range, because of values ''? ie ['google','google.com','','','','','','','','','','']
eager tips on how improve build type of function mysql sql python-2.7 pymysql
Comments
Post a Comment