Michael Bayer ha scritto: > > On Jan 29, 2007, at 11:30 AM, Manlio Perillo wrote: > >> >> The problem is that sometimes (at random, but I'm not sure), >> SQLAlchemy >> wants to use the lazy loader for comments, when I do session.load >> (Derived). >> > > thats sometimes due to an "eager degrade". eager loading will > generally not issue its LEFT OUTER JOIN if constructing the query > means it will loop back to the originating table in one query...it > will stop at the point before it gets there. this kind of thing > actually happens a lot. this can occur when using backrefs...if you > have A and B with eager refs to each other, and you load an A with > its B's, hitting the "A" collection on each "B" will incur as a lazy > load...since the eager loader isnt going to eager load A->B->A->B->A... >
Ok, I have noted this. However this is not the case for me. > but im not sure if thats whats happening here. maybe something up > with load(), id guess if the instance is already in the session > maybe. This should not happen. I load the object in a transaction (in a thread pool, where I create a new session and then destroy it). After loading the object, I try to access to the comments attribute in a function (in the main thread, in this case). This happens in a web application, in a POST command. The full sequence is: POST /id 1) load object by id {separate thread, transaction with session} 2) access the object attributes (I need this for validation) {main thread} 3) validate the POST data {main thread} 4) update the object {separate thread, transaction with session} The problem is in 2) > it would help if you could show me more fully what youre doing. > Now I'm tring to hit the exception, but all works fine. Thanks and regards Manlio Perillo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---