I’m attempting to update multiple items in a row, my code is as follows:
updateQuery = "UPDATE Throughput SET Test_Date = '%s' , Iperf11ntcpUL = '%s' , Iperf11ntcpDL = '%s' , Iperf11nudpUL = '%s' , Iperf11nudpDL = '%s' , HttpDL = '%s' , HttpUL = '%s', notes2='%s' where DeviceName = '%s' and Buildinfo ='%s' and Band = '%s' and Buildtype = '%s' " %(date, data['Iperf 11N TCP UL'], data['Iperf 11N TCP DL'], data['Iperf 11N UDP UL'], data['Iperf 11N UDP DL'], data['HTTP DL'],data['HTTP UL'],data['Notes'], data['Device Name'], data['Build Info / No.'], data['Band'], data['Build Type'])
cursor.execute(updateQuery)
I get the following error when this code is executed:
Previous SQL was not a query.
I ended up figuring out the problem myself.
I was executing my updateQuery within the following loop:
instead, I grabbed the id from the row and after exiting the loop, I executed the update statement for the acquired id