Revision 8164
Added by Aaron Marcuse-Kubitza almost 12 years ago
import | ||
---|---|---|
3 | 3 |
cd "$(dirname "$0")" |
4 | 4 |
. ../../../lib/import.sh |
5 | 5 |
|
6 |
map_table |
|
6 | 7 |
psql <<'EOF' |
7 |
SELECT functions.to_global_col_names('"TREE"'); |
|
8 |
|
|
9 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.STATECD" TO ".STATECD" $$); |
|
10 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.UNITCD" TO ".UNITCD" $$); |
|
11 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.COUNTYCD" TO ".COUNTYCD"$$); |
|
12 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.PLOT" TO ".PLOT" $$); |
|
13 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.INVYR" TO ".INVYR" $$); |
|
14 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.CONDID" TO ".CONDID" $$); |
|
15 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.SUBP" TO ".SUBP" $$); |
|
16 |
SELECT functions.rename_if_exists($$ALTER TABLE "TREE" RENAME "TREE.SPCD" TO ".SPCD" $$); |
|
17 |
|
|
18 | 8 |
SELECT functions.set_col_types('"TREE"', ARRAY[ |
19 | 9 |
('.STATECD' , 'integer') |
20 | 10 |
, ('.UNITCD' , 'integer') |
Also available in: Unified diff
inputs/FIA/*/import: Use map_table to set column names based on the contents of map.csv, instead of using functions.to_global_col_names() and functions.rename_if_exists(). Added map.csv for all tables.