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

WIP: Mode to update the current season. #64

Merged
merged 4 commits into from
Dec 13, 2021
Merged

WIP: Mode to update the current season. #64

merged 4 commits into from
Dec 13, 2021

Conversation

mpope9
Copy link
Owner

@mpope9 mpope9 commented Nov 22, 2021

For issue: #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:

  • If no new games are added, bail early.
    • Do this by evaluating the EXCEPT predicate early.
  • Temp table creation atm conflicts with creating a fresh DB. The dependent objects do not yet exist.
    • Could be fixed by checking the current mode, if it was stored in the settings object.
    • Confirm that this is still broken after other changes before implementing.
  • Expand what is stored in the Settings class.
    • We're passing alot of cmd line args to the different mode functions.
    • If they were stored in Settings it'd be easier.
  • Move schema create function to db_utils.
  • Evaluate temp table indexes
    • Most probably aren't needed?
  • Figure out debug logging flags.
    • Would be useful to diagnose bugs by looking at the peewee queries.

@mpope9
Copy link
Owner Author

mpope9 commented Nov 22, 2021

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...

@mpope9 mpope9 merged commit 63b6d8f into master Dec 13, 2021
@mpope9 mpope9 deleted the current-season branch December 13, 2021 00:41
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

Successfully merging this pull request may close these issues.

1 participant