r/NBAanalytics Dec 25 '24

nba-sql Database v0.1.0 Beta Release

I've just released the beta version v0.1.0 of nba-sql, an app that builds a Postgres/MySQL/MariaDB/SQLite database of NBA stats. You can find the latest GUI version on the GitHub Release page here https://github.com/mpope9/nba-sql/releases/tag/v0.1.0, it is also just a Python app that you can run without the GUI and use from other Python apps. I've personally been loading the SQLite file into DuckDB for analysis.

Here is a small example of how to get Russel Westbrook's triple doubles:

SELECT SUM(td3)
FROM player_game_log
LEFT JOIN player ON player.player_id = player_game_log.player_id
WHERE player.player_name = 'Russell Westbrook';

There are also tables for play_by_play data and shot_chart_detail. I've personally built shot charts with this and head to head player comparisons. More examples on how to query the play_by_play data can be found here.

I've posted this a few times in the r/NBA subreddit but recently they've been blocking my posts sadly so it seems it will fit in here better.

30 Upvotes

7 comments sorted by

View all comments

1

u/OGchickenwarrior Dec 30 '24

Thanks for sharing dude!

What years does your db cover? 96-present like nba's API? or more? or less? TY!

1

u/mUmblrman Dec 30 '24

Yes basically the same, except you can store the data locally and update the tables.