From 91438f4dc0244d6fa29c8fe8372ad5fcc04ae17e Mon Sep 17 00:00:00 2001 From: Jian Yuan Lee Date: Thu, 19 May 2022 17:47:56 +0100 Subject: [PATCH] Modify db clean to also catch the ProgrammingError exception (#23699) (cherry picked from commit a80b2fcaea984813995d4a2610987a1c9068fdb5) --- airflow/utils/db_cleanup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/utils/db_cleanup.py b/airflow/utils/db_cleanup.py index 93e86c78252bd..b02d08503f3a3 100644 --- a/airflow/utils/db_cleanup.py +++ b/airflow/utils/db_cleanup.py @@ -27,7 +27,7 @@ from pendulum import DateTime from sqlalchemy import and_, false, func -from sqlalchemy.exc import OperationalError +from sqlalchemy.exc import OperationalError, ProgrammingError from airflow.cli.simple_table import AirflowConsole from airflow.jobs.base_job import BaseJob @@ -260,7 +260,7 @@ def __enter__(self): return self def __exit__(self, exctype, excinst, exctb): - caught_error = exctype is not None and issubclass(exctype, OperationalError) + caught_error = exctype is not None and issubclass(exctype, (OperationalError, ProgrammingError)) if caught_error: logger.warning("Table %r not found. Skipping.", self.table) return caught_error