Cool, thanks! I got it working pretty wel I think. I replaced the iterator code with a Session.get. Check out the code here: http://paste.pocoo.org/show/13434/
The only thing I am still wondering if Session.get also returns objects in Session.new? Otherwise this won't fix the other bug. I think it does as my tests pass fine. You just earned yourself another sushi meal ;-) Koen On Dec 1, 8:40 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Dec 1, 2007, at 9:33 AM, Koen Bok wrote: > > > > > This is quite hackish, but just an experiment for me. > > > We use listen/notify in our app. A seperate thread is listening for > > notifications from updated rows in the table. If one is received I'd > > like to expire an object in the Session cache so it gets refetched the > > next time it is accessed. I have it working, but I get a lot of these: > > > AttributeError: 'ReceiveRequest' object has no attribute > > '_instance_key' > > > I guess that's because the background thread is marking objects as > > expired while the main thread is performing actions on them. > > _instance_key doesn't get removed by the expire operation, so thats > something else. i notice youre iterating through the whole session > which will return objects from "new" as well, so you might want to > iterate just through session.identity_map.values() there. also i > dont understand the point of that little iterate through > session.registry.registry but the main idea seems OK. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---