Strange problem: MySQL and python logging using two separate cursors

Chris Mellon arkanes at
Fri Jan 11 20:06:02 CET 2008

On Jan 9, 2008 11:52 AM, Dennis Lee Bieber <wlfraed at> wrote:
> On Wed, 9 Jan 2008 10:11:09 +0100, Frank Aune <Frank.Aune at>
> declaimed the following in comp.lang.python:
> > The only clue I have so far, is that the cursor in task 1 seems to be unable
> > to "register" any new entries in the log table produced by task 2 as soon as
> > task 1 perform an SQL query of some kind.
> >
>         How often do you issue a commit? For some DB-API adapters (I forget
> which database -- think it was SQLite) a select query does not complete
> until the last data has been fetched from it -- meaning the transaction
> (the DB-API spec is that auto-commit is OFF) is still open and "other
> transaction changes" will not be seen. {I do find it perplexing that
> transactions are started by cursor actions, but committed by the
> connection!}
> > Im contemplating using the same cursor for task 1 and 2, but I think keeping
> > them separate is a better design - if it only worked :)
> >
>         I'd probably suggest using a separate connection and cursor -- with
> liberal usage of conn.commit() to ensure that transaction "views" are
> flushed/refreshed.

The MySql api doesn't have a concept of a cursor, only connections. If
you want truly separate cursors in MySql you need to use individual

More information about the Python-list mailing list