db restore rollback fix
This commit is contained in:
parent
a46e12638e
commit
31955751fb
1 changed files with 4 additions and 2 deletions
|
|
@ -486,12 +486,14 @@ def _insertRows(
|
|||
|
||||
try:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("SAVEPOINT row_sp")
|
||||
cur.execute(sql, values)
|
||||
inserted += cur.rowcount
|
||||
cur.execute("RELEASE SAVEPOINT row_sp")
|
||||
except Exception as e:
|
||||
logger.warning("Insert failed for %s row: %s", tableName, e)
|
||||
conn.rollback()
|
||||
conn.autocommit = False
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("ROLLBACK TO SAVEPOINT row_sp")
|
||||
|
||||
return inserted
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue