Skip to content

Commit

Permalink
Updated unemployment load script
Browse files Browse the repository at this point in the history
  • Loading branch information
petewarden committed Feb 11, 2012
1 parent b32443c commit ffe529a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sql/loadcountyunemployment.sql
@@ -1,4 +1,3 @@
-- See http://www.spatialdbadvisor.com/postgis_tips_tricks/118/loading point data from a csv file in postgis

CREATE TABLE us_county_unemployment(
state_code CHAR(2),
Expand All @@ -10,6 +9,12 @@ CREATE TABLE us_county_unemployment(
PRIMARY KEY(state_code, county_code, year, month, value_type)
);

-- If you hit duplicated primary key errors on this load, there's probably a few cities mistakenly
-- categorised as counties in the la.area file. You can fix this by adding the full codes of the
-- city versions to $blacklisted_blas in createblatofips.php and re-running the csv creation.
-- To detect duplicates, run this:
-- sed 's/[0-9]\{1,\},//' ../blsdata/blatofips.csv | sort | uniq -d

COPY us_county_unemployment ( state_code, county_code, year, month, value_type, value )
FROM '/home/ubuntu/sources/blsdata/county_percentages.csv'
WITH DELIMITER AS ',' CSV HEADER;
Expand Down

0 comments on commit ffe529a

Please sign in to comment.