diff options
author | Frederick Muriuki Muriithi | 2023-11-22 11:41:35 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-11-22 11:41:35 +0300 |
commit | f680b53ab0c1d4e12b141662e2e26506efd06509 (patch) | |
tree | 97e06db8127ab3da8b2a9e8b7ec64ea228197a21 /gn_auth/auth/db/sqlite3.py | |
parent | feaf215b9f36c1c25a7329eed91e1fdcb068a02f (diff) | |
download | gn-auth-f680b53ab0c1d4e12b141662e2e26506efd06509.tar.gz |
Only commit on successful query
Only commit changes if the queries are successful.
Diffstat (limited to 'gn_auth/auth/db/sqlite3.py')
-rw-r--r-- | gn_auth/auth/db/sqlite3.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gn_auth/auth/db/sqlite3.py b/gn_auth/auth/db/sqlite3.py index 1844ca5..9849b59 100644 --- a/gn_auth/auth/db/sqlite3.py +++ b/gn_auth/auth/db/sqlite3.py @@ -48,12 +48,12 @@ def cursor(conn: DbConnection) -> Iterator[DbCursor]: cur = conn.cursor() try: yield cur + conn.commit() except sqlite3.Error as exc: conn.rollback() logging.debug(traceback.format_exc()) raise exc finally: - conn.commit() cur.close() def with_db_connection(func: Callable[[DbConnection], Any]) -> Any: |