-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
psycopg2.IntegrityError: insert or update on table "play" violates foreign key constraint "play_pos_team_fkey" #289
Comments
Same problem |
same issue |
tried #194 ? |
That does fix this, but I would suggest adding a (or multiple) alias fields to the team table for these teams with various abbreviations: |
Someone might use those as abbreviations for those teams, but not NFL.com. The issue here is that the NFL shifted gears and used
|
Touché. My suggestion came from a perspective of being able to associate the correct team with respect to the relocations that have/will occur as well as essentially serve as an optional, secondary ID for each team_id. This extra field on the table wouldn't impact the play-by- play, just help the end-user with statistical analysis over time. |
Just seeing your last sentence, that works too. Thank you. |
You should add LAC too:
|
I encountered the following when running nfldb-update
STARTING NFLDB UPDATE AT 2017-11-18 18:17:37.189874
Connecting to nfldb... done.
Setting timezone to UTC... done.
Locking write access to tables... done.
Updating season phase, year and week... done.
Adding schedule data for 16 games... done.
Bulk inserting data for 257 games...
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Sending batch of data to database.
Traceback (most recent call last):
File "/usr/local/bin/nfldb-update", line 39, in
nfldb.update.run(**vars(args))
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 535, in run
doit()
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 525, in doit
update_games(db, batch_size=batch_size)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 397, in update_games
bulk_insert_game_data(cursor, scheduled, batch_size=batch_size)
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 195, in bulk_insert_game_data
do()
File "/usr/local/lib/python2.7/dist-packages/nfldb/update.py", line 188, in do
nfldb.db._big_insert(cursor, table, bulk[table])
File "/usr/local/lib/python2.7/dist-packages/nfldb/db.py", line 356, in _big_insert
% (table, insert_fields, values))
File "/usr/local/lib/python2.7/dist-packages/psycopg2/extras.py", line 249, in execute
return super(RealDictCursor, self).execute(query, vars)
psycopg2.IntegrityError: insert or update on table "play" violates foreign key constraint "play_pos_team_fkey"
DETAIL: Key (pos_team)=(JAX) is not present in table "team".
The text was updated successfully, but these errors were encountered: