[Twisted-Python] Twisted + SQLAlchemy

Ed Suominen general at eepatents.com
Fri May 5 11:14:25 MDT 2006


I've received an inquiry about how I'm using SQLAlchemy under Twisted. I
thought I'd provide the answer so that others can benefit from it as well:

http://foss.eepatents.com/pNetworkX/browser/trunk/pnetworkx/database.py

Note particularly the "transact" function, which is used as a decorator.
Thanks to Valentino Volonghi (aka Dialtone) for the fine idea of using a
decorator to set up a nonblocking transaction (using deferToThread) for
whatever functions are so designated.

Here's a usage example, with various database-accessing methods that are
decorated with "@transact":

http://foss.eepatents.com/pNetworkX/browser/trunk/pnetworkx/edges.py

Best regards,
Ed Suominen




More information about the Twisted-Python mailing list