[Twisted-Python] [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

Chris Withers chris at simplistix.co.uk
Fri Mar 26 08:16:29 EDT 2010

Matthew Williams wrote:
> "It's much trickier if you want to use the ORM, unless you are very
> careful to fully eager load every thing in any possible database
> operation if you have need of the information subsequently in your
> twisted code. Otherwise you may block unexpectedly simply when
> accessing your objects, and end up with database operations from the
> main twisted thread."
> So perhaps I should have said "SQL Alchemy's ORM and threads don't get 
> along too well"... that's not to say it's impossible, you just have to 
> be exceedingly careful how you use it.

I think you have the wrong end of the stick.
SQLAlchemy and threads play fine, SQLAlchemy and Twisted's asynchronous 
model, which refuses to use threads on principle, do not, for the 
reasons you describe.

>>> It took me quite some time to piece together everything I could find  
>>> related to sAsync (which seems to be a dead but functional project),  
>>> so I threw up a quick Trac page for it at http://sasync.org.
>> Cool. What is it you're doing that needs to mix Twisted and SQLAlchemy?
> The project (an internal project) doesn't really *need* to mix them... I 
> could just use mysqldb.

Heh, wrong end of the stick again; my question was why you needed to use 
Twisted ;-)



Simplistix - Content Management, Batch Processing & Python Consulting
             - http://www.simplistix.co.uk

More information about the Twisted-Python mailing list