Skip to content

Commit ea013a2

Browse files
REGR: fix read_sql delegation for queries on MySQL/pymysql (#25024)
1 parent da5f5eb commit ea013a2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/whatsnew/v0.24.1.rst

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Fixed Regressions
2222

2323
- Bug in :meth:`DataFrame.itertuples` with ``records`` orient raising an ``AttributeError`` when the ``DataFrame`` contained more than 255 columns (:issue:`24939`)
2424
- Bug in :meth:`DataFrame.itertuples` orient converting integer column names to strings prepended with an underscore (:issue:`24940`)
25+
- Fixed regression in :func:`read_sql` when passing certain queries with MySQL/pymysql (:issue:`24988`).
2526
- Fixed regression in :class:`Index.intersection` incorrectly sorting the values by default (:issue:`24959`).
2627
- Fixed regression in :func:`merge` when merging an empty ``DataFrame`` with multiple timezone-aware columns on one of the timezone-aware columns (:issue:`25014`).
2728

pandas/io/sql.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None,
381381

382382
try:
383383
_is_table_name = pandas_sql.has_table(sql)
384-
except (ImportError, AttributeError):
384+
except Exception:
385+
# using generic exception to catch errors from sql drivers (GH24988)
385386
_is_table_name = False
386387

387388
if _is_table_name:

0 commit comments

Comments
 (0)