ca11of lucky
ca11of lucky

Reputation: 1

Update mysql table through python script

I have been trying to use MySql with Python and I had been using mysql connector.

Whenever I use cursor to execute commands, it works while the script is running but when I run the script again, the changes I made are gone.

Please help! Thanks in advance

Upvotes: 0

Views: 59

Answers (1)

ruohola
ruohola

Reputation: 24038

You need to commit the changes to the database with:

cursor.commit()

Otherwise they will reset when the cursor gets deleted.

Upvotes: 2

Related Questions