sqlite python insert -


i have asked similar question before , here detailed explanation of i'm trying achieve

i have 2 sqlite tables
table1 - standard table - has fields server,id,status table2 - has fields server,id,status,number,logfile

table2 empty , table1 has values. i'm trying fill table2 entries table1. can retrieve records table1 ,but while trying insert table2 fails.(but inserting single field works)

self.cursor.execute("select * server_table1 limit (?)",t) #insert server_process  record in self.server_pool_list:     print "--->",record # geting output ---> (u'cloud_sys1', u'free', u'192.168.1.111')     self.cursor.execute("insert server_table2(server,status,id) values (?,?,?)",(record[0],)(record[1],),(record[2],)); 

and let me know how produce more useful error messages when insert fails

this statement broken:

self.cursor.execute("insert server_table2(server,status,id) values (?,?,?)",(record[0],)(record[1],),(record[2],)); 

it should read:

self.cursor.execute("insert server_table2(server,status,id) values (?,?,?)",record[0:2]) 

and might want executemany think save ton of time.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -