Project

General

Profile

« Previous | Next » 

Revision 8164

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.

View differences:

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('"COND"');
8

  
9
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.STATECD"          TO ".STATECD"      $$);
10
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.UNITCD"           TO ".UNITCD"       $$);
11
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.COUNTYCD"         TO ".COUNTYCD"     $$);
12
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.PLOT"             TO ".PLOT"         $$);
13
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.INVYR"            TO ".INVYR"        $$);
14
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.CONDID"           TO ".CONDID"       $$);
15
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.HABTYPCD1"        TO ".HABTYPCD"     $$);
16
SELECT functions.rename_if_exists($$ALTER TABLE "COND" RENAME "COND.HABTYPCD1_PUB_CD" TO ".HABTYP_PUB_CD"$$);
17

  
18 8
SELECT functions.set_col_types('"COND"', ARRAY[
19 9
  ('.STATECD' , 'integer')
20 10
, ('.UNITCD'  , 'integer')

Also available in: Unified diff