Skip to content

Commit

Permalink
Modify db clean to also catch the ProgrammingError exception (#23699)
Browse files Browse the repository at this point in the history
(cherry picked from commit a80b2fc)
  • Loading branch information
jianyuan authored and ephraimbuddy committed May 21, 2022
1 parent d7092b7 commit dd22e54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions airflow/utils/db_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd22e54

Please sign in to comment.