[Tutor] MySQLdb question.
Kent Johnson
kent37 at tds.net
Fri Jul 28 20:05:22 CEST 2006
Ron Phillips wrote:
> I am trying to write a script that adds data to a table using
> MySQLdb.py. For some reason, "INSERT" seems to work temporarily. I
> run a command to insert a row, and then do a select query, and it's
> there. After the program shuts down, though, it's gone. No rows are
> permanently created. SELECT works fine from MySQLdb, CREATE TABLE too,
> but when I add data, it's only there while the script is executing,
> then it's gone.
Try calling conn.commit() before conn.close(). IIRC older versions of
MySQL were set to auto-commit by default but newer versions require the
explicit commit.
Kent
More information about the Tutor
mailing list