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('"PLOT"', ARRAY[ |
9 |
('STATECD', 'integer') |
|
10 |
, ('UNITCD', 'integer') |
|
11 |
, ('COUNTYCD', 'integer') |
|
9 |
('*STATECD', 'integer')
|
|
10 |
, ('*UNITCD', 'integer')
|
|
11 |
, ('*COUNTYCD', 'integer')
|
|
12 | 12 |
, ('locationName', 'integer') |
13 |
, ('INVYR', 'integer') |
|
13 |
, ('*INVYR', 'integer')
|
|
14 | 14 |
]::col_cast[]); |
15 | 15 |
|
16 | 16 |
SELECT create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.ID" UNIQUE ("locationID")$$); |
17 |
SELECT create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.unique" UNIQUE ("STATECD", "UNITCD", "COUNTYCD", "locationName", "INVYR")$$);
|
|
17 |
SELECT create_if_not_exists($$ALTER TABLE "PLOT" ADD CONSTRAINT "PLOT.unique" UNIQUE ("*STATECD", "*UNITCD", "*COUNTYCD", "locationName", "*INVYR")$$);
|
|
18 | 18 |
SELECT cluster_once('"PLOT"', '"PLOT.unique"'); |
19 | 19 |
EOF |
20 | 20 |
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