Changed the isolation_level to REPEATABLE READ from READ COMMITTED. REPEATABLE READ is the default.
This commit is contained in:
@@ -15,9 +15,10 @@ db_uri = settings.SQLALCHEMY_DB_URI
|
||||
# log.setLevel(logging.INFO)
|
||||
|
||||
connection_string = db_uri
|
||||
engine = create_engine(url=connection_string, pool_size=5, max_overflow=15, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||
engine = create_engine(url=connection_string, pool_size=5, max_overflow=15, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='REPEATABLE READ', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||
# NOTE: The default isolation_level is 'REPEATABLE READ'. This can sometimes not show updated data.
|
||||
# NOTE: The "echo" set to True option shows the SQL queries.
|
||||
# NOTE: Switching from READ COMMITTED to REPEATABLE READ. Testing started 2024-04-23
|
||||
|
||||
log.info('DB SQL trying to connect...')
|
||||
try:
|
||||
@@ -59,7 +60,7 @@ def sql_connect(
|
||||
settings.SQLALCHEMY_DB_URI = 'mysql://'+DB['username']+':'+DB['password']+'@'+DB['server']+'/'+DB['name']
|
||||
log.debug(settings.DB)
|
||||
|
||||
new_engine = create_engine(url=settings.SQLALCHEMY_DB_URI, pool_size=5, max_overflow=15, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='READ COMMITTED', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||
new_engine = create_engine(url=settings.SQLALCHEMY_DB_URI, pool_size=5, max_overflow=15, pool_recycle=settings.DB['pool_recycle'], pool_pre_ping=True, echo=False, echo_pool=True, isolation_level='REPEATABLE READ', connect_args={'connect_timeout': settings.DB['connect_timeout']})
|
||||
|
||||
current_db.engine = new_engine
|
||||
log.info(f'Created and connected to database: {settings.SQLALCHEMY_DB_URI}')
|
||||
@@ -703,7 +704,7 @@ def sql_select(
|
||||
|
||||
sql_fulltext_match_against = ''
|
||||
if fulltext_qry_dict:
|
||||
log.info('Creating partial SQL string for fulltext search.')
|
||||
log.info('Creating partial SQL string for fulltext search.')
|
||||
sql_fulltext_match_against, data_qry = sql_fulltext_qry_part(fulltext_qry_dict)
|
||||
|
||||
# NOTE: Merge the data_qry result with the data dict
|
||||
|
||||
Reference in New Issue
Block a user