How mpope9/nba-sql works
nba-sql loads NBA statistics into a queryable SQLite, PostgreSQL, or MySQL/MariaDB database, either for selected historical seasons or to refresh the current season. The CLI driver coordinates domain-specific fetchers and builders; fetched data is mapped into relational tables and batch-inserted. The README also documents play-by-play, shot-chart, season, team, and player-stat capabilities. Edges reflect the sampled driver, requester, and model references; unsampled subsystem details are limited to documented capabilities and indexed dependencies.
Main entry points: nba_sql.py CLI driver · models Relational models · general_requester.py HTTP requester · player.py Player data
Components 18
Load orchestration
- CLI driver
stats/nba_sql.py
NBA data fetch
- Player data
stats/player.py - Team data
stats/team.py - Game data
stats/game.py - Season data
stats/season.py - Event types
stats/event_message_type.py - Player seasons
stats/player_season.py - Player game logs
stats/player_game_log.py - Player totals
stats/player_general_traditional_total.py - Play by play
stats/play_by_play.py - Play by play v3
stats/play_by_playv3.py - Shot charts
stats/shot_chart_detail.py - HTTP requester
stats/general_requester.py
Domain tables
- Relational models
stats/models
Storage layer
- Batch inserts
stats/db_utils.py
Other components
- Operator
- NBA stats API
- SQL database
Connections 33
- Operator → CLI driver: runs
README.md - CLI driver → Player data: dispatches
stats/nba_sql.py - CLI driver → Team data: dispatches
stats/nba_sql.py - CLI driver → Game data: dispatches
stats/nba_sql.py - CLI driver → Season data: dispatches
stats/nba_sql.py - CLI driver → Event types: dispatches
stats/nba_sql.py - CLI driver → Player seasons: dispatches
stats/nba_sql.py - CLI driver → Player game logs: dispatches
stats/nba_sql.py - CLI driver → Player totals: dispatches
stats/nba_sql.py - CLI driver → Play by play: dispatches
stats/nba_sql.py - CLI driver → Play by play v3: dispatches
stats/nba_sql.py - CLI driver → Shot charts: dispatches
stats/nba_sql.py - Player data → HTTP requester: uses
stats/player.py - Team data → HTTP requester: uses
stats/team.py - Player seasons → HTTP requester: uses
stats/player_season.py - Player game logs → HTTP requester: uses
stats/player_game_log.py - Player totals → HTTP requester: uses
stats/player_general_traditional_total.py - Shot charts → HTTP requester: uses
stats/shot_chart_detail.py - HTTP requester → NBA stats API: requests data
stats/general_requester.py - Player data → Relational models: maps to
stats/player.py - Team data → Relational models: maps to
stats/team.py - Game data → Relational models: builds
stats/game.py - Season data → Relational models: maps to
stats/season.py - Event types → Relational models: maps to
stats/event_message_type.py - Player seasons → Relational models: maps to
stats/player_season.py - Player game logs → Relational models: maps to
stats/player_game_log.py - Player totals → Relational models: maps to
stats/player_general_traditional_total.py - Play by play → Relational models: maps to
stats/play_by_play.py - Play by play v3 → Relational models: maps to
stats/play_by_playv3.py - Shot charts → Relational models: maps to
stats/shot_chart_detail.py - HTTP requester → Batch inserts: batch inserts
stats/general_requester.py - Batch inserts → SQL database: writes rows
stats/db_utils.py - CLI driver → SQL database: configures connection
README.md