On Thu, Sep 14, 2017 at 10:03 AM, Ankur Kumar
<ankur.kumar.o...@gmail.com> wrote:
> I'm using Flask, sqlalchemy with MySQL database for my API server.
>
> It's working fine with one front end API server.
> But now i want to increase a front end API server in my Load balancer.
>
> So, the scenario will be two (Flask + sqlalchemy) server and 1 MySQL server.
>
> The issue that the new user is not able to read data committed by another
> server until any session.commit() is called.
>
> I know i can use "autocommit=True" in sessionmaker but i don't want to use
> it.
>
> Is there any other solution?
>
> I'm also attaching sample  raw script  for demo of the issue
>

If you want to be able to read uncommitted data from another
transaction, you need to use a lower isolation level (presumably READ
UNCOMITTED):

https://dev.mysql.com/doc/refman/5.7/en/innodb-transaction-isolation-levels.html

http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html#setting-transaction-isolation-levels

(Obviously with lower transaction isolation comes the possibility of
reading inconsistent data and so on)

Hope that helps,

Simon

-- 
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