Browse files

super simple script to load IRE census data into a PSQL database. Edi…

…t the DATABASE variable to your needs.
  • Loading branch information...
1 parent ce61d9f commit 79c8b6302c6b681ef8bc890c0d8d7cce01db63f2 @JoeGermuska JoeGermuska committed Feb 23, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 tools/sql/ire_export/
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+LOWER_TABLE=`echo $TABLE | tr '[A-Z]' '[a-z]'`
+echo table $TABLE state $STATE sumlev $SUMLEV
+curl${TABLE}.sql | psql $DATABASE
+curl${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}

0 comments on commit 79c8b63

Please sign in to comment.