Re: [sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-15 Thread Jonathan Vanasco
I had a similar need under Pyramid and went with a different approach: My "dbSession" object is actually a proxy container that holds dedicated Read, Write, and Log SqlAlchemy sessions. I explicitly address "dbSession.reader" or "dbSession.writer" in all code. Everything that is "public

Re: [sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-15 Thread Simon King
On Thu, Dec 15, 2016 at 10:00 AM, Simon King wrote: > On Thu, Dec 15, 2016 at 2:07 AM, Matt wrote: >> >> >> On Wednesday, December 14, 2016 at 3:58:19 PM UTC+1, Mike Bayer wrote: >>> >>> >>> When you want to switch between "writer" and "reader", the

Re: [sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-15 Thread Simon King
On Thu, Dec 15, 2016 at 2:07 AM, Matt wrote: > > > On Wednesday, December 14, 2016 at 3:58:19 PM UTC+1, Mike Bayer wrote: >> >> >> When you want to switch between "writer" and "reader", the "reader" must >> be fine with using a totally clean transaction and that means totally >>

Re: [sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-14 Thread Matt
On Wednesday, December 14, 2016 at 3:58:19 PM UTC+1, Mike Bayer wrote: > > > When you want to switch between "writer" and "reader", the "reader" must > be fine with using a totally clean transaction and that means totally > new objects and everything inside that Session as well. For a web >

[sqlalchemy] SQLAlchemy dedicated read-server pooling

2016-12-13 Thread Matt
I am currently writing a Flask web application that uses Flask-SQLAlchemy to communicate with a Postgres database. I want to have several read-replicas to which all database read queries can be directed, while all read+write queries can go to the master database instance. In other words, a