[Tutor] MySQLdb question.

shawn bright nephish at gmail.com
Fri Jul 28 20:20:48 CEST 2006


you may be missing db.commit().
When you do insert, update, etc.. you call commit() to make the changes
stick.

-sk

On 7/28/06, Kent Johnson <kent37 at tds.net> wrote:
>
> 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
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060728/7a9e0e0e/attachment.htm 


More information about the Tutor mailing list