I am trying to insert data into my SQL database however, I am receiving the following error:
sqlite3.OperationalError: unrecognized token: "7nbtkq".
Note, the value 7nbtkq is a public key of one of the data that I am trying to update.
I have looked at several other solutions but they are either different scenarios that don't apply to mine or their solutions haven't worked for me.
sql = """UPDATE parent_reply SET parent_id = '{}', comment_id = '{}', parent = '{}', comment = '{}', subreddit = {}, unix = {}, score = {} WHERE parent_id ={};""".format(parentid, commentid, parent, comment, subreddit, int(time), score, parentid)
c.execute(sql)
I am expecting my SQL database to be updated with these new values on the according record.
SET parent_id = '{}' ... WHERE parent_id ={}looks like one of placeholders is wrong. Shouldn't both be surrounded by quotes? - Sergparent_id = '{}'in `SET parent_id = '{}' . . . WHERE parent_id = '{}'because it has to be anyway due to the WHEN? - BlueCanaryparent_id = '{}'inSETclause. - Serg