[Twisted-Python] SQLAlchemy and Twisted

Kevin Horn kevin.horn at gmail.com
Thu May 6 14:00:33 MDT 2010


You might also check out sAsync: http://sasync.org/

This was a project apparently abandoned (?) by the original author, but it's
recently been picked up by someone else.

Kevin Horn

On Thu, May 6, 2010 at 2:04 PM, César García <celord at gmail.com> wrote:

> Guys, now that I see this and the past conversations about SA and Twisted,
> and now that I've read some more about the non-blocking concepts, I think
> that I'am not doing things the best way
>
>  I am doing this:
>
> 1. Twisted  IMAP4 Client to read my mails
> 2. Inside this client I import a module that contains some funtions that
> parse the email via re
> 3. Also inside the client I import a module that makes a DB connection and
> insert the data parsed from those emails, all this via SQL using mapped
> tables.
>
> I'm almost sure that I'm breacking the hole twisted concept doing this
> thisway , do you guys have any advice for me
>
> Thanks
> 2010/5/5 Chris Withers <chris at simplistix.co.uk>
>
> Doug Farrell wrote:
>> >
>> > I’ve been doing some searching about how to get SQLAlchemy and Twisted
>> > working together in a Twisted application.
>>
>> Short version: to be safe, anything that touches any SQLAlchemy-mapped
>> object needs to be run in its own thread. Any query or access of an
>> attribute of a mapped object may result in a blocking sql query. (aka:
>> twisted doesn't play nice with orms)
>>
>> > definitive answer. The most promising one I’ve run across concerns
>> > running the SQLAlchemy queries in a separate process (rather than a
>> > separate thread) and communicating the queries between the Twisted
>> > application in one process and the SQLAlchemy application in another.
>>
>> That seems a little odd.
>> What would be the IPC?
>> How would the "sqlachemy application" be run?
>>
>> > 1)      Would the SQLAlchemy process also be a Twisted application with
>> > all the queries running as deferreds in the main thread, and blocking?
>>
>> What do you men by "all the queries"?
>>
>> > Thanks in advance for any help!
>>
>> In my case, since most of the app I'm working on is "web requested"
>> (either xmlrpc or http), I just agve up and used a good wsgi stack
>> (repoze.bfg in my case) and munge other incoming requests into wsgi
>> requests.
>>
>> Twisted's wsgi server runs each request in its own thread, so be it.
>>
>> cheers,
>>
>> Chris
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>
>
>
> --
> http://celord.blogspot.com/
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20100506/72e70bd5/attachment.html>


More information about the Twisted-Python mailing list