Question: Why is this sqlite3 statement not updating the record?
Info:
cur.execute('UPDATE workunits SET Completed=1 AND Returns=(?) WHERE PID=(?) AND Args=(?)',(pickle.dumps(Ret),PID,Args))
I'm using python and sqlite3. this statement does not throw an error, it just seems like it is out right ignored. for testing reasons I included below it:
cur.execute('SELECT * FROM workunits WHERE PID=(?) AND Args=(?)',(PID,Args))
Which returns a record just fine. but the record doesn't up date with the new value of the pickled ret. it remains u''. I can't figure out why. my where statement seems to work. my syntax seems to be correct because there is no error being thrown. I'm clueless as to why exactly it doesn't work.
If the problem persists after you fixed your syntax. Please make sure you're using:
conn.commit()
After cur.execute, UPDATES and INSERTS require COMMIT.
don't use 'AND', use a ','.
cur.execute('UPDATE workunits SET Completed=1, Returns=? WHERE PID=? AND Args=?',
(pickle.dumps(Ret), PID, Args)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With