On Aug 9, 2007, at 3:59 AM, Alexandre CONRAD wrote:
> >> But also, if you want to say Session(), then work with it, that is >> also the intended usage model, although the Session.xxx methods >> should in theory be all you need. > > Why should I instantiate session = Session() if everything off the > class > is directly available ? because you would have written some application that doesnt use scoped_session, and says Session() all over the place. then you add scoped_session in at the configuration level, but no code needs to change. so it makes code portable between scoped/non-scoped. > > Basicly, it crashes when the mapper is taken from the Session object > *after* it got instantiated. It works fine before. its because you are renaming the "Session" class to be your session instance and overwriting the class with a local variable; the code is wrong in both cases. you should leave "Session" hanging around as your Session class. when you instantiate, call it something different, usually "session". > > Don't forget to answer my question: "What are the benefits of > instantiating a Session object ?". Actually, I just feel better > working > *with* a instantiated object. you just answered it.... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---