From 8ad0609f50dc2d2ef6434e3d7b983386d7dfbc2c Mon Sep 17 00:00:00 2001 From: Brian Warren Date: Fri, 25 Aug 2017 18:04:55 -0500 Subject: [PATCH] Added shell script to work around error while running nfldb-update --- top-ten-qbs.py | 5 +++-- update_nfldb_with_workaround.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 update_nfldb_with_workaround.sh diff --git a/top-ten-qbs.py b/top-ten-qbs.py index 98fa244..2b3baf0 100644 --- a/top-ten-qbs.py +++ b/top-ten-qbs.py @@ -8,6 +8,7 @@ q.game(season_year=2012, season_type='Regular') for pp in q.sort('passing_yds').limit(10).as_aggregate(): print pp.player, pp.passing_yds -q.game(season_year=2016, season_type='Regular') -for game in q.as_games(): +#q.game(season_year=2016, season_type='Regular') +#for game in q.as_games(): +# print pp.player, pp.passing_yds \ No newline at end of file diff --git a/update_nfldb_with_workaround.sh b/update_nfldb_with_workaround.sh new file mode 100644 index 0000000..a114444 --- /dev/null +++ b/update_nfldb_with_workaround.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# This is a workaround for an error that occurs when running 'nfldb-update' where some of the JSON data it +# gets from the internet contains "JAX" instead of "JAC" as the key for the Jacksonville Jaguars team +psql --username=nfldb nfldb --command="INSERT INTO team VALUES ('JAX', 'Jacksonville', 'Jaguars')" +nfldb-update +psql --username=nfldb nfldb --command="UPDATE play SET pos_team = 'JAC' WHERE pos_team = 'JAX'" +psql --username=nfldb nfldb --command="DELETE FROM team WHERE team_id = 'JAX'" \ No newline at end of file