Skip to content

BUG: fix checking of table name in read_sql (GH7826) #7961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/v0.15.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ For full docs, see the :ref:`Categorical introduction <categorical>` and the




- Bug in checking of table name in ``read_sql`` in certain cases (:issue:`7826`).



Expand Down
7 changes: 6 additions & 1 deletion pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down