ephraimbuddy commented on code in PR #66296:
URL: https://github.com/apache/airflow/pull/66296#discussion_r3388478427
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -284,12 +284,12 @@ def _do_delete(
session.execute(delete)
session.commit()
- except BaseException as e:
- raise e
+ except BaseException:
+ session.rollback()
Review Comment:
```suggestion
with suppress(Exception):
session.rollback()
```
Since session.rollback() can raise, this avoid its exception shadowing the
BaseException
##########
airflow-core/src/airflow/utils/db_cleanup.py:
##########
@@ -284,12 +284,12 @@ def _do_delete(
session.execute(delete)
session.commit()
- except BaseException as e:
- raise e
+ except BaseException:
+ session.rollback()
+ raise
finally:
if target_table is not None and skip_archive:
- bind = session.get_bind()
- target_table.drop(bind=bind)
+ target_table.drop(bind=session.connection())
Review Comment:
Can you add a comment why we are doing this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]