nba-sql: Peewee error?

Hello, I’m getting the following issue when trying to download via SQLite on Windows. I’m still able to run SQLite, do SQL queries, and all that, so it must not be affecting functionality too much. I assume maybe I’d created the team.team_id database entries previously and it was just clashing because it had to overwrite it? I’m relatively new to all this so it could be some dependency I don’t have or something to do with my system.

Traceback (most recent call last):
  File "peewee.py", line 3144, in execute_sql
sqlite3.IntegrityError: UNIQUE constraint failed: team.team_id

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "nba_sql.py", line 394, in <module>
  File "gooey\python_bindings\gooey_decorator.py", line 134, in <lambda>
  File "nba_sql.py", line 218, in main
  File "nba_sql.py", line 343, in populate_base_tables
  File "general_requester.py", line 51, in populate
  File "db_utils.py", line 15, in insert_many
  File "db_utils.py", line 28, in __insert_many_sqlite
  File "peewee.py", line 1907, in inner
  File "peewee.py", line 1978, in execute
  File "peewee.py", line 2745, in _execute
  File "peewee.py", line 2474, in _execute
  File "peewee.py", line 3157, in execute
  File "peewee.py", line 3151, in execute_sql
  File "peewee.py", line 2917, in __exit__
  File "peewee.py", line 190, in reraise
  File "peewee.py", line 3144, in execute_sql
peewee.IntegrityError: UNIQUE constraint failed: team.team_id

Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

Sorry for the delay on this. I re-built the windows client and give it a run through locally. Looks good.

That shot_chart_detail issue was also not real. I just didn’t refresh my dbeaver connection when I rebuilt the database. It looks good, too.

You can find the release here: https://github.com/mpope9/nba-sql/releases/tag/v0.0.6 thanks for reporting this!

Ok this should be fixed on master I believe. I can cut another windows build tomorrow, but you can also create your own using this script: https://github.com/mpope9/nba-sql/blob/master/scripts/build_exe.txt

However when doing some testing I noticed that shot_chart_detail is not populated correctly on sqlite, it only works on postgres and mysql. I’ve filed this follow up for it: https://github.com/mpope9/nba-sql/issues/61

I’ll close this issue once I take it out for a spin tomorrow night.

I was able to repro it with the GUI version. I’ll see what I can do.

Since I’m making the PR I’ll just toss that in because it is a one line change.

OK, I am sitting on a PR that I forgot to merge. It should make this easier going forward. It includes a --skip-tables option that takes the team table as an option. I’ll see if I can clean that up and merge it tonight and cut a new windows release. I will tag you in a comment here when its done and we can see if it solves the issue.

I’d like to limit on_conflict_ignore to base tables like team, as I feel like it could cause data issues but I’m not 100% certain. I think merging the expanded --skip-tables option is better overall.

And thank you!