Re: [sqlalchemy] What exactly is the rationale behind manage the life cycle of the session externally to functions that deal with specific data.?

2015-08-12 Thread Mike Bayer
On 8/11/15 9:51 PM, Jinghui Niu wrote: In the Documentation -- Session Basics, I read this: E.g. don’t do this: ### this is the **wrong way to do it** ### class ThingOne(object): def go(self): session = Session() try:

[sqlalchemy] What exactly is the rationale behind manage the life cycle of the session externally to functions that deal with specific data.?

2015-08-11 Thread Jinghui Niu
In the Documentation -- Session Basics, I read this: E.g. don’t do this: ### this is the **wrong way to do it** ### class ThingOne(object): def go(self): session = Session() try: session.query(FooBar).update({x: 5}) session.commit()