Skip to content

Loading and Exporting US voters database

dkakkar edited this page Aug 13, 2020 · 2 revisions
  • Launch the Postgis app and create the database
  • CSV schema should be as follows:
id varchar(255), lat double precision, lon double precision, pid varchar(255), state varchar(255), grp varchar(255)
  • Replace $location in the script with the location of your .csv
vi /n/holyscratch01/enos_lab/$user/partisan/import.sql
  • Run the import script
ssh $databasenode
screen
module load postgis
time psql -h localhost -p $port -d $database -f /n/holyscratch01/enos_lab/$user/partisan/import.sql
  • Export the database for future use
pg_dump -O -x -h localhost -p $port -Fc $databasename > /n/holyscratch01/enos_lab/$user/partisan/$databasename.pgsql