diff --git a/doc/source/v0.15.0.txt b/doc/source/v0.15.0.txt index ecfd7b5ada055..ac475d637f9cf 100644 --- a/doc/source/v0.15.0.txt +++ b/doc/source/v0.15.0.txt @@ -400,7 +400,7 @@ For full docs, see the :ref:`Categorical introduction ` and the - +- Bug in checking of table name in ``read_sql`` in certain cases (:issue:`7826`). diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 914ade45adaa1..d9d20c3b8b835 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -420,7 +420,12 @@ def read_sql(sql, con, index_col=None, coerce_float=True, params=None, sql, index_col=index_col, params=params, coerce_float=coerce_float, parse_dates=parse_dates) - if pandas_sql.has_table(sql): + try: + _is_table_name = pandas_sql.has_table(sql) + except: + _is_table_name = False + + if _is_table_name: pandas_sql.meta.reflect(only=[sql]) return pandas_sql.read_table( sql, index_col=index_col, coerce_float=coerce_float,