Revision 10054
Added by Aaron Marcuse-Kubitza over 11 years ago
import | ||
---|---|---|
6 | 6 |
map_table |
7 | 7 |
psql <<'EOF' |
8 | 8 |
SELECT set_col_types('"COUNTY"', ARRAY[ |
9 |
('STATECD', 'integer') |
|
10 |
, ('UNITCD', 'integer') |
|
11 |
, ('COUNTYCD', 'integer') |
|
9 |
('*STATECD', 'integer')
|
|
10 |
, ('*UNITCD', 'integer')
|
|
11 |
, ('*COUNTYCD', 'integer')
|
|
12 | 12 |
]::col_cast[]); |
13 | 13 |
|
14 |
SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.ID" UNIQUE ("COUNTY-CN")$$); |
|
15 |
SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.unique" UNIQUE ("STATECD", "UNITCD", "COUNTYCD")$$);
|
|
14 |
SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.ID" UNIQUE ("*COUNTY-CN")$$);
|
|
15 |
SELECT create_if_not_exists($$ALTER TABLE "COUNTY" ADD CONSTRAINT "COUNTY.unique" UNIQUE ("*STATECD", "*UNITCD", "*COUNTYCD")$$);
|
|
16 | 16 |
EOF |
17 | 17 |
mk_derived |
Also available in: Unified diff
inputs/FIA/SUBPLOT/map.csv, import: prepended * to all FIA terms to clearly distinguish them from the VegCore terms. this is the standard convention for all datasources, to indicate which terms have not yet been mapped, but was not yet implemented at the beginning of new-style import (the FIA refresh was the first new-style datasource).
the following replacements were performed to make this change:
in all map.csv: replace regexp (?<=,)(?=[A-Z_]{2,}) with *
in all import:
replace regexp (?<=[^']")(?<!TABLE )(?=(?!\w+\.)[A-Z_]{2,}) with *
manually undo any replacements on table names
replace regexp (?<=\(')\b(?=(?!\w+\.)[A-Z_]{2,}) with *
$ ./inputs/FIA/import