Skip to content

Commit

Permalink
Set connections to autocommit to avoid transaction conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Costanzo <[email protected]>
  • Loading branch information
ianco committed Jul 5, 2024
1 parent 8a7c630 commit f00e841
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data-pipeline/bcreg/bcreg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, cache=False):
self.conn.set_session(readonly=True)
#self.conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
self.conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ)
self.conn.autocommit = True

# Register the adapter
sqlite3.register_adapter(decimal.Decimal, adapt_decimal)
Expand All @@ -70,6 +71,7 @@ def __init__(self, cache=False):
self.sec_conn.set_session(readonly=True)
#self.sec_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
self.sec_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ)
self.sec_conn.autocommit = True
except (Exception) as error:
LOGGER.error(error)
LOGGER.error(traceback.print_exc())
Expand Down

0 comments on commit f00e841

Please sign in to comment.