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 
> application this usually means "reader" has to be selected at the start 
> of the request, and the whole request consults "reader" only.  You can't 
> switch between two different DB transactions mid-request, one of which 
> has been writing new rows, and expect to see the same rows between those 
> two transactions, the transactions will have some degree of isolation 
> from each other. 
>
> Short answer, you can't direct writer/reader at the "query" level, 
> unless you put the Session into autocommit mode and run COMMIT after 
> every statement.  Normally it has to be at the transaction level. 
>
>
It would be acceptable to select the read server at the start of a web 
request. I am still a little lost on how to get to that behavior, though. 
Any insights there? How do I bind the read server at the transaction level?

 

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to