From bf41acc423bbbe54a07663610c6e6a21cd35d803 Mon Sep 17 00:00:00 2001 From: Maxime Borry Date: Fri, 5 Jan 2024 13:40:24 +0000 Subject: [PATCH] catch pymysql operational error --- ibis/backends/mysql/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)