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:
|
try:
|
||||||
with conn.cursor() as cur:
|
with conn.cursor() as cur:
|
||||||
|
cur.execute("SAVEPOINT row_sp")
|
||||||
cur.execute(sql, values)
|
cur.execute(sql, values)
|
||||||
inserted += cur.rowcount
|
inserted += cur.rowcount
|
||||||
|
cur.execute("RELEASE SAVEPOINT row_sp")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Insert failed for %s row: %s", tableName, e)
|
logger.warning("Insert failed for %s row: %s", tableName, e)
|
||||||
conn.rollback()
|
with conn.cursor() as cur:
|
||||||
conn.autocommit = False
|
cur.execute("ROLLBACK TO SAVEPOINT row_sp")
|
||||||
|
|
||||||
return inserted
|
return inserted
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue