[Twisted-Python] Using sqlalchemy in twisted.

Peter Cai newptcai at gmail.com
Thu Mar 12 00:05:29 EDT 2009

I've read some mails in this list that recommend use sqlalchemy in separate

But if u use multiprocessing which provides only synchronous API, doesn't
you have to use deferToThread also?

Another way would be using "twisted.internet.protocol.ProcessProtocol",
which use pipes.  But can we pass SA Objects through pipes?

If you can write a little code to describe how you use multiprocessing,  I
will be very thankful!

On Wed, Mar 11, 2009 at 1:22 AM, luper rouch <luper.rouch at gmail.com> wrote:

> I would recommend sandboxing Twisted code in another process when used
> in conjunction with synchronous code (sqlalchemy, GUI, etc...). This
> proved quite simple in my project, using the multiprocessing module
> [1], and avoided me lots of headaches since.
> This way I don't mix coding styles everywhere using deferToThread(),
> nor do I care about threads safety madness.
> Now I'm not sure if this could apply to your situation, but if like me
> you're just routing the SA traffic through Twisted (just guessing as
> you mentioned deferToThread()), have not so much interaction between
> Twisted and the synchronous code part, it might be a better solution
> than writing wrappers / limiting your usage of the synchronous code.
> Luper
> [1]http://code.google.com/p/python-multiprocessing/ (now part of python
> 2.6)
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

look to the things around you,the immediate world around you, if you are
alive,it will mean something to you ——Paul Strand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20090312/d3448a04/attachment.htm 

More information about the Twisted-Python mailing list