This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
##=========================================================== | |
## Import ACS 2012 1 year extension | |
## GPLv3 Oct 2013 -dbb | |
## | |
## Useage: python import_master_20121yr_8.py Sequence_Number_and_Table_Number_Lookup.txt work_dir | |
## assumes an existing database 'census_acs_2012' ; currently writes to public schema | |
## | |
## Note: results in ~1480 tables plus 1478 more per state, so | |
## max_locks_per_transaction must be manually increased |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys,re | |
# more hacks | |
# remove the last two lines from the saved output | |
# psql | |
# > create database pkgs1; | |
# > \c pkgs1 | |
# pkgs1=# create table raw_parse (script_name text, action text, pkg_name text); | |
# pkgs1=# copy raw_parse from '/home/user/out1.csv' with CSV delimiter E'\t'; | |
# pkgs1=# select pkg_name from raw_parse group by pkg_name having every(action <> 'REMOVE') order by pkg_name; |
NewerOlder