Re: [sqlalchemy] Why is this pattern discouraged in SQLAlchemy?

2017-08-07 Thread Jinghui Niu
Thanks very much for the informative reply Mike! On Sun, Aug 6, 2017 at 9:38 PM, Mike Bayer wrote: > > > On Aug 6, 2017 8:11 PM, "Jinghui Niu" wrote: > > When reading the official SQLAlchemy documentation, I found the example > below: > > ###

Re: [sqlalchemy] Why is this pattern discouraged in SQLAlchemy?

2017-08-06 Thread Mike Bayer
On Aug 6, 2017 8:11 PM, "Jinghui Niu" wrote: When reading the official SQLAlchemy documentation, I found the example below: ### this is the **wrong way to do it** ### class ThingOne(object): def go(self): session = Session() try:

[sqlalchemy] Why is this pattern discouraged in SQLAlchemy?

2017-08-06 Thread Jinghui Niu
When reading the official SQLAlchemy documentation, I found the example below: ### 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()