Re: [sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Sam Lee
Thanks. I was comparing Session.remove() vs. Session().rollback(). So, since I'm not using objects (as in orm), but only use Session().execute(), it's okay to use .rollback() instead of .remove(). But, it's better to use .remove(). I think it's clear now. Thanks On Fri, Oct 27, 2017 at 1:41

Re: [sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Mike Bayer
On Fri, Oct 27, 2017 at 11:55 AM, Sam Lee wrote: > I'm using scoped_session in a single threaded daemon that has infinite loop > and sleeps after each iteration. > It's only doing queries (does not write to db). > > I guess unit of work for this daemon is an iteration. > From

[sqlalchemy] session.close() vs. rollback or commit

2017-10-27 Thread Sam Lee
I'm using scoped_session in a single threaded daemon that has infinite loop and sleeps after each iteration. It's only doing queries (does not write to db). I guess unit of work for this daemon is an iteration. >From what I'm gathering from documentation, I should create a Session for each unit