diff options
-rw-r--r-- | wqflask/wqflask/database.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/wqflask/wqflask/database.py b/wqflask/wqflask/database.py index ad2d8216..0c1fddf1 100644 --- a/wqflask/wqflask/database.py +++ b/wqflask/wqflask/database.py @@ -40,5 +40,9 @@ def database_connection(sql_uri: str) -> Iterator[Connection]: ) try: yield connection + connection.commit() + except Exception as _exc: + connection.rollback() + raise _exc finally: connection.close() |