BUG: read_sql_table can't find views (original) (raw)

pd.read_sql_table(tablename, engine) won't be able to find tablename if it's actually a view.

This should be a one line change to https://github.com/pydata/pandas/blob/b281e6570bc3bb3773520eff0b6965d5691e3ba2/pandas/io/sql.py#L340

meta = MetaData(con, schema=schema)
try:
    meta.reflect(only=[table_name])
except sqlalchemy.exc.InvalidRequestError:
    raise ValueError("Table %s not found" % table_name)

just adding the keyword argument views=True from http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html I don't think there will be any negative consequences to this, but I don't use sqlalchemy MetaData objects that often.