diff --git a/ibis/backends/mysql/__init__.py b/ibis/backends/mysql/__init__.py index e14bea134a60..7ea409b73701 100644 --- a/ibis/backends/mysql/__init__.py +++ b/ibis/backends/mysql/__init__.py @@ -5,6 +5,7 @@ import warnings from typing import TYPE_CHECKING, Literal +import pymysql import sqlalchemy as sa from sqlalchemy.dialects import mysql @@ -112,7 +113,7 @@ def connect(dbapi_connection, connection_record): with dbapi_connection.cursor() as cur: try: cur.execute("SET @@session.time_zone = 'UTC'") - except sa.exc.OperationalError: + except (sa.exc.OperationalError, pymysql.err.OperationalError): warnings.warn("Unable to set session timezone to UTC.") super().do_connect(engine)