db.commit() to take effect

progman hong.file at gmail.com
Sun Dec 3 00:29:41 EST 2006


I was testing the python+mysql

here are my sample codes:
------------------------
import MySQLdb
from pprint import pprint
db = MySQLdb.connect(host="localhost", user="root", passwd="password",
db="database")
cursor = db.cursor()
cursor.execute('update promo set date=100")


------------------------

i was expecting the cursor.execute will update my db immediately.
it wasn't. not until i  run db.commit(), then only i see the value
changes.

it that the right way to update db?




More information about the Python-list mailing list