[sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Matthew Williams
On Mar 26, 2010, at 3:20 AM, Chris Withers wrote: Matthew Williams wrote: From previous posts to this and other lists, it seems that ORMs and threads don't get along too well... What makes you think that? First of all, most of my impressions about ORMs come from SQLAlchemy. This

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Chris Withers
Matthew Williams wrote: It's much trickier if you want to use the ORM, unless you are very careful to fully eager load every thing in any possible database operation if you have need of the information subsequently in your twisted code. Otherwise you may block unexpectedly simply when accessing

RE: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Matthew Williams Sent: 26 March 2010 12:10 To: sqlalchemy@googlegroups.com; twisted-pyt...@twistedmatrix.com Subject: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync On Mar

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Matthew Williams
On Mar 26, 2010, at 7:16 AM, Chris Withers wrote: Cool. What is it you're doing that needs to mix Twisted and SQLAlchemy? The project (an internal project) doesn't really *need* to mix them... I could just use mysqldb. Heh, wrong end of the stick again; my question was why you needed to

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Fernando Takai
Hi!, I'm using SQLAlchemy on a heavily threaded env - something like 30~40 threads working with SQLAlchemy objects. What you need to watchout is: * Eager load objects - getting nasty lazyload exceptions is not funny * Take off the objects from the session and, if you need to use them later,

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Chris Withers
King Simon-NFHD78 wrote: The solution to this is either to eager-load all the attributes you think you are going to need before handing the instance off to another thread (difficult), or (probably better) to detach (expunge) the instance from thread A's session. Are there any recommended code

Re: [sqlalchemy] Re: SQLAlchemy, Twisted, and sAsync

2010-03-26 Thread Michael Bayer
Fernando Takai wrote: Hi!, I'm using SQLAlchemy on a heavily threaded env - something like 30~40 threads working with SQLAlchemy objects. What you need to watchout is: * Eager load objects - getting nasty lazyload exceptions is not funny * Take off the objects from the session and, if you