making sqlalchemy work with twisted (was Re: [Twisted-Python] SQL Abstraction Layer_
exarkun at divmod.com
Wed Jan 18 19:10:54 EST 2006
On Wed, 18 Jan 2006 18:25:17 -0500, Paul G <paul-lists at perforge.com> wrote:
>to me, integrating sqlalchemy into twisted would ideally work in a way where
>all sqlalchemy api access is async. as i stated in my original mail, i
>currently believe that this could be possible to achieve by making all of
>sqlalchemy's calls into the dbapi module async with deferToThread(). if one
>does this, and it doesn't break something arcane in sqlalchemy, we shouldn't
>have to worry about deferreds in the client code. is there a reason why this
>wouldn't work or why it shouldn't be done that i am missing?
I think you are missing the fact that if you do this, attribute access
will result in a Deferred, not the value of the attribute from the
database, which is not available yet.
So client code will have to deal with Deferreds, and in an extremely
unusual manner - every attribute lookup will return a new Deferred.
More information about the Twisted-Python