mpope9 / nba-sql

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

Play By Play not populating for MySql #102

Closed mvgary094 closed 10 months ago

mvgary094 commented 10 months ago

Hello,

I'm getting good data for all other tables but play_by_play isn't populating in my mysql db. I tried running just that table and lowering the limit for the number of rows needed to push but that didn't help. I've attached the output of the terminal and run configuration if that helps

I'm also not seeing shot_chart_detail and player_general_traditional_total

image

image

mpope9 commented 10 months ago

Ah yeah, so in your command in the --skip-tables option you provide pgtt (player_general_traditional_total for short) and shot_chart_detail. So that explains those two tables, however it doesn't describe the play_by_play issue. Are there any errors when running, or does it report a successful run?

mvgary094 commented 10 months ago

Yea, it does run successfully. If you can see the rows[o] flags in the logs, you’ll find that it’s pulling good data. I’ll take another look after work, but I was starting to think it may be pushing to SQLite or something else instead

mvgary094 commented 10 months ago

I was able to figure out that the multithreading executor wasn't actually running the insert_batch command. I removed that just to see what happened and now I'm getting the following error:

peewee.IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (nba.play_by_play, CONSTRAINT play_by_play_ibfk_3 FOREIGN KEY (player1_id) REFERENCES player (player_id))')

I then went in and manually dropped the foreign key constraints on the player_id fields and now I'm seeing data in the MySQL DB.

Should I close this or should we try to figure out the root cause?