[Twisted-Python] Re: So how does everyone use an ORM in twisted?

Maciej Szumocki mszumocki at contman.pl
Tue Mar 17 11:36:31 EDT 2009

> From: Ryan Lepidi <ryeguy1 at gmail.com>
> Subject: [Twisted-Python] So how does everyone use an ORM in twisted?
> To: twisted-python at twistedmatrix.com
> Message-ID:
> 	<bb39cd350903170805p2fca87casbc3cd6c932bb9439 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> I have searched a bit, and it seems as though you can't use SQL Alchemy with
> twisted due to SA being thread unsafe. The only solution I found was sAsync,
> but this is old and unmaintained. What is everyone else doing for database
> access for a multiuser server? Is everyone really using raw sql queries or
> is there some easy solution that I'm missing?
> I'm not even stuck on SQL Alchemy; if there is some other ORM that works in
> this case, I'd be willing to learn it.

I'm using SQLAlchemy with Twisted in a large project without problems. 
Why would you think you cannot?
You just need to run SA operations in non-reactor threads (i currently use my own
threadpool and deferToThread but it's only slightly modified standard twisted one),
and you need to make sure each connection/session is not used by more than thread
at a time, that's all.

Maciej Szumocki

More information about the Twisted-Python mailing list