diff options
author | Frederick Muriuki Muriithi | 2023-08-18 14:50:01 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-08-18 14:50:01 +0300 |
commit | d5d0c4718a49c5a9d26a069c5d5964d58bb324f9 (patch) | |
tree | 06bd4950e6d44556efd6c958582700ecdbec70a5 | |
parent | 684d9e37381120f171aff5f9f9a58ceaefa1901e (diff) | |
download | genenetwork3-d5d0c4718a49c5a9d26a069c5d5964d58bb324f9.tar.gz |
Commit on success, rollback on error.
-rw-r--r-- | gn3/db_utils.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gn3/db_utils.py b/gn3/db_utils.py index 2f65a33..5fd250d 100644 --- a/gn3/db_utils.py +++ b/gn3/db_utils.py @@ -35,7 +35,10 @@ def database_connection(sql_uri) -> Iterator[Connection]: port=port or 3306) try: yield connection + except mdb.Error as _mbde: + connection.rollback() finally: + connection.commit() connection.close() |