Skip to content
Snippets Groups Projects
Commit c03c2151 authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

use psycopg3's transaction in `BaseDb.transaction`

There is a dedicated logic in psycopg3, so lets simply uses it.
parent 2c966bae
No related branches found
No related tags found
No related merge requests found
......@@ -184,14 +184,9 @@ class BaseDb:
a psycopg cursor
"""
with self.conn.cursor() as cur:
try:
with self.conn.transaction():
with self.conn.cursor() as cur:
yield cur
self.conn.commit()
except Exception:
if not self.conn.closed:
self.conn.rollback()
raise
def copy_to(
self,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment