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

2017-10-27 Thread Sam Lee
PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > On Fri, Oct 27, 2017 at 11:55 AM, Sam Lee <skyn...@gmail.com> wrote: > > I'm using scoped_session in a single threaded daemon that has infinite > loop > > and sleeps after each iteration. > > It's only doing queri

[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

Re: [sqlalchemy] Mock DBAPI connection for testing custom creator

2017-10-18 Thread Sam Lee
Bayer <mike...@zzzcomputing.com> wrote: > On Tue, Oct 17, 2017 at 4:58 PM, Sam Lee <skyn...@gmail.com> wrote: > > Hi, > > > > I am passing a custom creator to sqlalchemy.create_engine(). > > And, I want to simulate the following scenario in automated test witho

[sqlalchemy] Mock DBAPI connection for testing custom creator

2017-10-17 Thread Sam Lee
Hi, I am passing a custom creator to sqlalchemy.create_engine(). And, I want to simulate the following scenario in automated test without using actual database connection: 1. Request a connection from pool: connects to DB. 2. DB goes down. 3. Request a connection from pool: connection is