Skip to content
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

PGTT Loading Error #97

Closed
mpope9 opened this issue Nov 5, 2023 · 1 comment
Closed

PGTT Loading Error #97

mpope9 opened this issue Nov 5, 2023 · 1 comment

Comments

@mpope9
Copy link
Owner

mpope9 commented Nov 5, 2023

There is some kind of key error that is exposed when the headers section from the request doesn't match up with the underlying DB object. This wasn't exposed as an issue before because they always lined up when this was initially written. Some form of resilience is probably good to have.

@mpope9
Copy link
Owner Author

mpope9 commented Nov 5, 2023

Traceback (most recent call last):
  File "/Users/boneSaw/Projects/nba-sql/stats/nba_sql.py", line 350, in <module>
    main(args, False)
  File "/Users/boneSaw/Projects/nba-sql/stats/nba_sql.py", line 305, in main
    default_mode(settings, create_schema, request_gap, seasons, skip_tables, quiet or from_gui)
  File "/Users/boneSaw/Projects/nba-sql/stats/nba_sql.py", line 196, in default_mode
    pgtt_requester.generate_rows(season_id)
  File "/Users/boneSaw/Projects/nba-sql/stats/player_general_traditional_total.py", line 42, in generate_rows
    column_mapping = get_rowset_mapping(result_sets, column_names)
  File "/Users/boneSaw/Projects/nba-sql/stats/utils.py", line 21, in get_rowset_mapping
    return {column: headers.index(column.upper()) for column in column_names}
  File "/Users/boneSaw/Projects/nba-sql/stats/utils.py", line 21, in <dictcomp>
    return {column: headers.index(column.upper()) for column in column_names}
ValueError: 'CFID' is not in list

stack trace for reference. New headers returned by the API

'resultSets': [{'name': 'LeagueDashPlayerStats', 'headers': ['PLAYER_ID', 'PLAYER_NAME', 'NICKNAME', 'TEAM_ID', 'TEAM_ABBREVIATION', 'AGE', 'GP', 'W', 'L', 'W_PCT', 'MIN', 'FGM', 'FGA', 'FG_PCT', 'FG3M', 'FG3A', 'FG3_PCT', 'FTM', 'FTA', 'FT_PCT', 'OREB', 'DREB', 'REB', 'AST', 'TOV', 'STL', 'BLK', 'BLKA', 'PF', 'PFD', 'PTS', 'PLUS_MINUS', 'NBA_FANTASY_PTS', 'DD2', 'TD3', 'WNBA_FANTASY_PTS', 'GP_RANK', 'W_RANK', 'L_RANK', 'W_PCT_RANK', 'MIN_RANK', 'FGM_RANK', 'FGA_RANK', 'FG_PCT_RANK', 'FG3M_RANK', 'FG3A_RANK', 'FG3_PCT_RANK', 'FTM_RANK', 'FTA_RANK', 'FT_PCT_RANK', 'OREB_RANK', 'DREB_RANK', 'REB_RANK', 'AST_RANK', 'TOV_RANK', 'STL_RANK', 'BLK_RANK', 'BLKA_RANK', 'PF_RANK', 'PFD_RANK', 'PTS_RANK', 'PLUS_MINUS_RANK', 'NBA_FANTASY_PTS_RANK', 'DD2_RANK', 'TD3_RANK', 'WNBA_FANTASY_PTS_RANK']

mpope9 added a commit that referenced this issue Nov 5, 2023
mpope9 added a commit that referenced this issue Nov 5, 2023
@mpope9 mpope9 closed this as completed Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant