Hi Ben De,
engine.execute() get a connection from connection pool, execute the
statement and then return back the connection to connection pool. When
you tried to view the most up to date information you might be using
other connection.
If you wants to set UR isolation level to all the connection then you
can implement the 'connect' event listener interface, in this you can
set the isolation level for the connection. connect event function get
called for each new connection. For more info you can go through
http://docs.sqlalchemy.org/en/rel_0_8/core/interfaces.html?highlight=connect#sqlalchemy.interfaces.PoolListener.connect.
Following sample code which will help you in setting isolation level
through 'connect' event listener
===
from sqlalchemy import *
from sqlalchemy import event
def my_connect(dbapi_con, con_record):
cur = dbapi_con.cursor()
cur.execute('set current isolation to UR')
cur.close()
db = create_engine('db2+ibm_db://user:password@hostname:port/
database')
event.listen(db, 'connect', my_connect)
===
Thanks,
Rahul