[Twisted-Python] SQLAlchemy and Twisted

alex clemesha clemesha at gmail.com
Thu May 8 18:03:32 EDT 2008


I didn't want to hijack the 'Twisted Presentation Materials..' thread,
so I started this one ...

First off, in the other thread,
Glenn, you mentioned Storm.  I have heard of Storm, but never got
any deeper that noticing that it is still a work in progress (maybe
things have settled down ?)
If anyone has anything to say on how it might be a good choice with
Twisted, please feel free to enlighten us!

But, I hoping to solve some immediate problems with Twisted and
SQLAlchemy, so ...
>> * A main "App Server", that controls high level access with "twisted.cred"
>> * Web frontend:  "twisted.web2"
>> * Data:  some "twisted.enterprise.adbapi", moving to SQLAlchemy.
> Interesting; how are you handling asynchrony in SA?
This is the issue that we're stilling unclear on, and I really
would like to know of the best way of integrating Twisted with SQLAlchemy.

Twisted devs / experts:  Please, could you comment on the right way of
using Twisted and SQLAlchemy together.

Anyone: If anyone know of existing code that integrates Twisted and
SQLAlchemy nicely, please share!

RIght away I just went about the problem be wrapping each call
to SQLAlchemy in a "deferToThread" inside my  "DatabaseManager" class.
At startup of my app, I make an instance of this class, and pass it to
each "avatar" (in "requestAvatar", in my portal)

Here is my Database Manager: (you will actually see that I 'turned
off' the deferToThread wrapping for now):

but I really haven't convinced myself that this is the best way of doing things.
Hell, it could be totally wrong, so if anyone has any advice, I would
be very appreciative!

> I'm aware of sAsync,
> but haven't looked much into it.  (I'm a step or two behind you, actively
> using adbapi, and thinking about moving to SA when I get some breathing
> room.)
I've looked into SAsync as well, but it is not totally clear to me
what the extra benefit of it is (again, anyone who has a good
description, please tell)
The main developer of sAsync use to post to this mailing list, but I haven't
seen him post in a fairly long while.

So, if others are thinking about using SQLAlchemy with Twisted, let's
discuss it more.

Thanks very much,

More information about the Twisted-Python mailing list