mpope9 / nba-sql

:basketball: An application to build an NBA database backed by MySQL, Postgres, or SQLite
Apache License 2.0
177 stars 22 forks source link

WIP: Mode to update the current season. #64

Closed mpope9 closed 2 years ago

mpope9 commented 2 years ago

For issue: https://github.com/mpope9/nba-sql/issues/63

This PR adds the concept of 'modes'. The existing method of creating the database will be determined by using the --default-mode commandline flag.

The new 'mode' that is introduced is updating the current season. This is specified by the --current_season_mode commandline switch. These are mutually exclusive groups in Gooey. This takes an existing database, loads all player_game_log entries into a temp table, then uses this new temp table (which should have more games than the existing player_game_log table) then uses set logic through an EXCEPT query to determine which games are new. This is used to update tables like game, shot_chart_detail, and player_game_log.

TODOs:

mpope9 commented 2 years ago

Passing the filter predicate to the shot_chart_detail finalize is...a bit messy? I'm not sure, while it seems like the most flexible way to support filtering on the temp table -> regular table insert I'm not sure if it will work in future contexts, if there are any...