Skip to content

Add exception when passing invalid column name to select_as_multiple #3307

Closed
@gravesee

Description

@gravesee

No exception is raised when requesting a column that doesn't exist in any of the key tables.

I think the desired behavior in this situation would be to check if the requested columns exist before performing retrieving the data. If any of the columns do not exist, raising an exception that lists the invalid columns would be very helpful.

When I finally finish my wrapper code, I will have a reverse dict that looks up the tables that the requested columns belong too (as suggest by @jreback on SO). I will add this safety check there as well, but it seems like a safe thing to add to select_as_multiple, too.

>>> pd.__version__
'0.11.0.dev-eb07c5a'

>>> tmp = store.select_as_multiple(['chunk0','chunk1'], columns=['SalesID','INVALID_COLUMN'])

>>> tmp
<class 'pandas.core.frame.DataFrame'>
Int64Index: 401125 entries, 0 to 1124
Data columns (total 1 columns):
SalesID    401125  non-null values
dtypes: int64(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions