On Mar 28, 2008, at 6:42 PM, john spurling wrote:
> > The funny part is that if I run this very same code in a standalone > Python process (where the process is kept alive, like the Apache > process), there is no caching behavior; the correct value is returned > every single time. If it's run in Apache, I can see the incorrect > value get returned in the logs (in the 'get_user' function above). In > either case, I see the query getting logged in MySQL's query logs. > > Any ideas at all? I've searched through both the mod_python and > sqlalchemy archives and haven't found anything appropriate. that is the symptom of a Session being reused - that the SQL is issued but it returns the existing identity map version. But the code you've illustrated should not have this problem since you are creating and closing a Session within the scope of a function call (but you said, that's only a "synopsis" of the code which I assume means it's not verbatim). I'd add logging which includes the in-memory identity of the Session in use as well as assertions that it's empty before use (assert len(list(session)) == 0). if a preceding session.clear() fixes the problem thats also a sign of that issue. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---