Answer the question
In order to leave comments, you need to log in
Can I do that?
I have many columns in a table.
And in order not to write my own UPDATE for each, can I specify what exactly to update?
cur.execute(f"UPDATE users SET ? = ? WHERE user_id=? AND chat_id=?")
cur.commit()
Answer the question
In order to leave comments, you need to log in
You can try this, but it won't cut your code that much:
cur.execute(f"UPDATE users SET field1=?, field2=?, fieldN=? WHERE user_id=? AND chat_id=?")
nnikolyaa , try using executemany() or executescript() instead of execute ( )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question