updates in sqlite3 do not work

kaens apatheticagnostic at gmail.com
Tue May 29 19:25:38 EDT 2007


On 5/29/07, Stefan Sonnenberg-Carstens
<stefan.sonnenberg at pythonmeister.com> wrote:
> Did you try a commit() ?
>
> SQLite3 works in autocommit mode by default,
> so it would help to see your code.
>
>
> On Mi, 30.05.2007, 00:30, Chris Fonnesbeck wrote:
> > I have a script set up to perform UPDATE commands on an sqlite database
> > using the sqlite3 module. Everything appears to run fine (there are no
> > error
> > messages), except that none of the UPDATE commands appear to have actually
> > updated the table. If I run each command on its own in a sqlite session,
> > the
> > UPDATE command works fine, so it is not a SQL syntax issue. UPDATE simply
> > seems not to work. Any idea what the problem might be?
> >
> > Thanks,
> > Chris
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
As the other people said, you need to issue db.commit() (or whatever
you're database variable is).

I just ran into this after converting a MyISAM table to InnoDB, and
was annoyed as crap for a while, until I found out that you need to
explicitly commit on InnoDB tables, then I felt stupid.

I was using MySQLdb, not sqlite3, but I'm sure it's got right around
the same functionality.



More information about the Python-list mailing list