Re: Executing SQL asynchronously

Skip Montanaro <[email protected]> Tue, 14 Jun 2005 19:16:21 -0500
Newsgroups gmane.comp.python.sybase
Message-ID <[email protected]>
    >> I need to perform inserts and updates to a Sybase database
    >> asynchronously.  Is there already a mechanism in sybase-python to do
    >> this?  I see the Sybase module uses threads extensively.

    Dave> I suppose the best way to do this would be to perform the SQL
    Dave> operations in one or more separate Python threads.

That's pretty much what I came up with.  My initial tests at the command
prompt led me to believe that maybe I'd done something wrong, but I think I
was fine.  An AsyncConnection class has its own hidden cursor and a Queue.
The client gets a fake cursor that does nothing more than stuff the (sql,
params) tuple into the queue where it's picked up and executed by the real
cursor running in a daemon thread.

Skip