Skip to content
This repository
tree: 79c8b6302c
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 11 lines (10 sloc) 0.514 kb
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/env bash
TABLE=$1
STATE=$2
SUMLEV=$3
LOWER_TABLE=`echo $TABLE | tr '[A-Z]' '[a-z]'`

DATABASE='nicar'
echo table $TABLE state $STATE sumlev $SUMLEV
curl https://raw.github.com/ireapps/census/master/tools/sql/ire_export/ire_${TABLE}.sql | psql $DATABASE
curl http://censusdata.ire.org/${STATE}/all_${SUMLEV}_in_${STATE}.${TABLE}.csv | gzcat > all_${SUMLEV}_in_${STATE}.${TABLE}.csv
psql -c "copy ire_${LOWER_TABLE} from '/Users/germuska/src/all_${SUMLEV}_in_${STATE}.${TABLE}.csv' csv header" ${DATABASE}
Something went wrong with that request. Please try again.