diff --git a/pyiceberg/catalog/sql.py b/pyiceberg/catalog/sql.py index 9436e208ca..62a2dac54a 100644 --- a/pyiceberg/catalog/sql.py +++ b/pyiceberg/catalog/sql.py @@ -32,7 +32,7 @@ union, update, ) -from sqlalchemy.exc import IntegrityError, NoResultFound, OperationalError +from sqlalchemy.exc import IntegrityError, NoResultFound, OperationalError, ProgrammingError from sqlalchemy.orm import ( DeclarativeBase, Mapped, @@ -112,7 +112,10 @@ def _ensure_tables_exist(self) -> None: stmt = select(1).select_from(table) try: session.scalar(stmt) - except OperationalError: + except ( + OperationalError, + ProgrammingError, + ): # sqlalchemy returns OperationalError in case of sqlite and ProgrammingError with postgres. self.create_tables() return