Must COMMIT after SELECT (was: Very weird behavior in MySQLdb "execute")

Frank Aune Frank.Aune at broadpark.no
Wed Feb 6 16:04:25 CET 2008


On Tuesday 05 February 2008 18:58:49 John Nagle wrote:
>     So you really do have to COMMIT after a SELECT, if you are reusing
> the database connection.  CGI programs usually don't have this issue,
> because their connections don't live long, but long-running FCGI (and maybe
> Twisted) programs do.

I've experienced the same thing for long-running tasks even when using 
different connections/cursors against the same db for db queries and log 
writing dbhandlers respectively.

Whenever I did a SELECT() on the first connection, the cursor would 
stop "seeing" new entries commited in the log table by the other connection. 
I always assumed you needed COMMIT() after adding new content to the 
database, not after every single query, but this perhaps indicate otherwise?

Regards,
Frank






More information about the Python-list mailing list