I am having trouble structuring an sqlite update statement that has multiple parameters. The following code does not raise an exception, but nor does it update my table. After extensive googling and searching Daniweb, I think I'm looking right at the blindingly obvious and missing it.
I have a list of tuples, PVitems which when iterated (as at the bottom of my code) looks like this:
The first integer is the PV count while the string is a meshblock number. All my meshblocks are handled as strings because many start with zeros. Some code:
conn = sqlite3.connect(db) g = conn.cursor() for pv in PVitems: try: g.execute('UPDATE meshblock_1107 SET etv_1107=? WHERE meshblock_06=?', (pv[0:2])) except: print("I dropped the ball:") g.close() for i in range(4): print(PVitems[i])
I have tried various formulations for the parameters at the end which either raise an exception or execute while failing to update. I have also tried splitting each parameter into individual tuples without joy. Any ideas what I am missing?