Re: [sqlalchemy] SQLAlchemy/Python: Using an engine per process, and injecting that engine into dependencies

2014-08-17 Thread Michael Bayer
On Aug 17, 2014, at 3:50 PM, Zach wrote: > ... from the calling application/method, and then inject the session into > these database helpers. Why? Well, I need to use one engine per process. I > think I need an inversion of control pattern here, but am having trouble > coming up with somethi

[sqlalchemy] SQLAlchemy/Python: Using an engine per process, and injecting that engine into dependencies

2014-08-17 Thread Zach
SQLAlchemy recommends using one engine per process because the underlying DBAPI connections are not necessarily safe to use across processes. I have global engine and session variables that gets lazily populated with a SQLAlchemy engine and a session factory, respectively. This makes it easy

[sqlalchemy] SQLAlchemy/Python: Using an engine per process, and injecting that engine into dependencies

2014-08-17 Thread Zach
SQLAlchemy recommends using one engine per process because the underlying DBAPI connections are not necessarily safe to use across processes. I have global engine and session variables that gets lazily populated with a SQLAlchemy engine and a session factory, respectively. This makes it easy