Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
mpope9 committed Feb 7, 2023
1 parent e691f14 commit 2b96312
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

An application to build a Postgres, MySQL, or SQLite NBA database from the public API.

The latest Linux, MacOs, and Windows releases [can be found in the releases section.](https://github.com/mpope9/nba-sql/releases/tag/v0.0.9).
The latest Linux, MacOS, and Windows releases [can be found in the releases section.](https://github.com/mpope9/nba-sql/releases/tag/v0.0.9).

This DB is still in it's alpha stage and liable to schema changes. v0.1.0 will be the final schema before an official migration system is added. Until then, expect to rebuild the whole DB when trying to refresh stats.

Expand Down Expand Up @@ -37,35 +37,43 @@ It will take an estimated 6 hours to build the whole database. However, some tab
## Commandline Reference
```
>python stats/nba_sql.py -h
usage: nba_sql.py [-h] [--database_name DATABASE_NAME] [--database_host DATABASE_HOST] [--username USERNAME] [--password PASSWORD]
[--seasons [1996-97,1997-98,1998-99,1999-00,2000-01,2001-02,2002-03,2003-04,2004-05,2005-06,2006-07,2007-08,2008-09,2009-10,2010-11,2011-12,2012-13,2013-14,2014-15,2015-16,2016-17,2017-18,2018-19,2019-20,2020-21,2021-22]
[--create-schema] [--database {mysql,postgres,sqlite}] [--time-between-requests REQUEST_GAP]
[--skip-tables [player_season,player_game_log,play_by_play,pgtt,shot_chart_detail,game,event_message_type,team,player]
[--batch_size BATCH_SIZE]
usage: nba_sql.py [-h] [--database {mysql,postgres,sqlite}] [--database_name DATABASE_NAME] [--database_host DATABASE_HOST]
[--username USERNAME] [--create-schema] [--time-between-requests REQUEST_GAP] [--batch_size BATCH_SIZE]
[--sqlite-path SQLITE_PATH] [--quiet] [--default-mode] [--current-season-mode] [--password PASSWORD]
[--seasons [{1997-98,1998-99,1999-00,2000-01,2001-02,2002-03,2003-04,2004-05,2005-06,2006-07,2007-08,2008-09,2009-10,2010-11,2011-12,2012-13,2013-14,2014-15,2015-16,2016-17,2017-18,2018-19,2019-20,2020-21,2021-22,2022-23} ...]]
[--skip-tables [{player_season,player_game_log,play_by_play,pgtt,shot_chart_detail,game,event_message_type,team,player,} ...]]
nba-sql
optional arguments:
-h, --help show this help message and exit
--database {mysql,postgres,sqlite}
The database flag specifies which database protocol to use. Defaults to "sqlite", but also accepts "postgres" and
"mysql".
--database_name DATABASE_NAME
Database Name (Not Needed For SQLite)
--database_host DATABASE_HOST
Database Hostname (Not Needed For SQLite)
--username USERNAME Database Username (Not Needed For SQLite)
--password PASSWORD Database Password (Not Needed For SQLite)
--seasons [1996-97,1997-98,1998-99,1999-00,2000-01,2001-02,2002-03,2003-04,2004-05,2005-06,2006-07,2007-08,2008-09,2009-10,2010-11,2011-12,2012-13,2013-14,2014-15,2015-16,2016-17,2017-18,2018-19,2019-20,2020-21,2021-22]
The seasons flag loads the database with the specified season. The format of the season should be in the form "YYYY-YY". The default behavior is
loading the current season. Example usage: --seasons 2019-2020 2020-2021
--create-schema Flag to initialize the database schema before loading data.
--database {mysql,postgres,sqlite}
The database flag specifies which database protocol to use. Defaults to "mysql", but also accepts "postgres" and "sqlite". Example usage:
--database postgres
--create-schema Flag to initialize the database schema before loading data. If the schema already exists then nothing will happen.
--time-between-requests REQUEST_GAP
This flag exists to prevent rate limiting, and we inject a sleep inbetween requesting resources.
--skip-tables [player_season,player_game_log,play_by_play,pgtt,shot_chart_detail,game,event_message_type,team,player]
Use this option to skip loading certain tables. Example: --skip-tables play_by_play pgtt
This flag exists to prevent rate limiting, and injects the desired amount of time inbetween requesting resources.
--batch_size BATCH_SIZE
Inserts BATCH_SIZE chunks of rows to the database. This value is ignored when selecting database 'sqlite'.
--sqlite-path SQLITE_PATH
Setting to define sqlite path.
--quiet Setting to define stdout logging level. If set, only "ok" will be printed if ran successfully. This currently only
applies to refreshing a db, and not loading one.
--default-mode Mode to create the database and load historic data. Use this mode when creating a new database or when trying to
load a specific season or a range of seasons.
--current-season-mode
Mode to refresh the current season. Use this mode on an existing database to update it with the latest data.
--password PASSWORD Database Password (Not Needed For SQLite)
--seasons [{1997-98,1998-99,1999-00,2000-01,2001-02,2002-03,2003-04,2004-05,2005-06,2006-07,2007-08,2008-09,2009-10,2010-11,2011-12,2012-13,2013-14,2014-15,2015-16,2016-17,2017-18,2018-19,2019-20,2020-21,2021-22,2022-23} ...]
The seasons flag loads the database with the specified season. The format of the season should be in the form
"YYYY-YY". The default behavior is loading the current season.
--skip-tables [{player_season,player_game_log,play_by_play,pgtt,shot_chart_detail,game,event_message_type,team,player,} ...]
Use this option to skip loading certain tables.
```

## :crystal_ball: Schema
Expand Down Expand Up @@ -153,9 +161,9 @@ Then activate it:
Install dependencies using:
`pip install -r requirements.txt`

##### OSX Errors
##### MacOS Errors

If you try to setup on OSX and see an error like
If you try to setup on MacOS and see an error like
```
Error: pg_config executable not found.
```
Expand Down

0 comments on commit 2b96312

Please sign in to comment.