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