[Twisted-Python] SQL Abstraction Layer

Valentino Volonghi aka Dialtone dialtone at divmod.com
Wed Jan 18 05:28:35 EST 2006

On Tue, Jan 17, 2006 at 09:34:11PM -0500, Paul G wrote:
> correct me if i'm wrong, but hacking/monkeypatching the sqlalchemy 
> accessors which implement this lazy load when attributes are accessed to 
> run their queries with deferToThread() would remove this problem, would it 
> not? more generally speaking, if you're not going to do explicit 
> deferToThread()s in your code (and avoid all attribute access), but rather, 
> say, insert them into the appropriate point in sqlalchemy (sqlengine seems 
> ro tbe the right place, or just a wrapper around the dbapi module), would 
> this not handle the issue as well? am i asking the wrong person/on the 
> wrong list? ;]

I don't think it's the right approach to patch sqlalchemy to run attribute
access in a thread. You would still get a deferred from an attribute access
and this is pretty hugly to handle.

Just using the eager mode would be perfect, the reason why I don't believe
that much in lazy queries is that you will end up using all the information,
otherwise it's better to query without using the ORM.

Currently SQLAlchemy is so good because it doesn't try to be clever but rather
only exposes the primitives and tries hard to be thread safe so that people
will be free to use it in the best way they want.

Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20060118/cbba7346/attachment.pgp 

More information about the Twisted-Python mailing list