Revision 11602
Added by Aaron Marcuse-Kubitza about 11 years ago
lib/runscripts/table.run | ||
---|---|---|
20 | 20 |
|
21 | 21 |
if self_not_included; then |
22 | 22 |
|
23 |
##### utils |
|
24 |
|
|
23 | 25 |
: "${table=$subdir}"; export table |
24 | 26 |
|
25 | 27 |
table_make() { subdir_make "$@"; } |
... | ... | |
49 | 51 |
|
50 | 52 |
map_table="\"~$table.map\"" # sort after other tables to avoid clutter |
51 | 53 |
|
54 |
##### targets |
|
55 |
|
|
56 |
load_data() |
|
57 |
{ |
|
58 |
echo_func; set_make_vars |
|
59 |
if remaking; then in_top_dir rm -f header.csv; fi # remake it |
|
60 |
datasrc_make_install schema |
|
61 |
is_view="$is_view" table_make_install ${_remake:+re}install # just the table |
|
62 |
} |
|
63 |
|
|
64 |
trim_table() |
|
65 |
{ |
|
66 |
echo_func; set_make_vars |
|
67 |
if test "$is_view"; then return 0; fi # do not modify view columns |
|
68 |
psql <<EOF |
|
69 |
SELECT util.trim('"$table"', '$map_table') |
|
70 |
EOF |
|
71 |
} |
|
72 |
|
|
52 | 73 |
reset_col_names() |
53 | 74 |
{ |
54 | 75 |
echo_func; set_make_vars |
... | ... | |
78 | 99 |
EOF |
79 | 100 |
} |
80 | 101 |
|
81 |
mk_derived() |
|
82 |
{ echo_func; set_make_vars; "$root_dir"/schemas/VegCore/mk_derived; } |
|
83 |
|
|
84 | 102 |
remake_VegBIEN_mappings() |
85 | 103 |
{ |
86 | 104 |
echo_func; set_make_vars |
... | ... | |
96 | 114 |
if test -e "$file"; then psql "$@"; fi |
97 | 115 |
} |
98 | 116 |
|
99 |
load_data() |
|
100 |
{ |
|
101 |
echo_func; set_make_vars |
|
102 |
if remaking; then in_top_dir rm -f header.csv; fi # remake it |
|
103 |
datasrc_make_install schema |
|
104 |
is_view="$is_view" table_make_install ${_remake:+re}install # just the table |
|
105 |
} |
|
117 |
mk_derived() |
|
118 |
{ echo_func; set_make_vars; "$root_dir"/schemas/VegCore/mk_derived; } |
|
106 | 119 |
|
107 |
trim_table() |
|
108 |
{ |
|
109 |
echo_func; set_make_vars |
|
110 |
if test "$is_view"; then return 0; fi # do not modify view columns |
|
111 |
psql <<EOF |
|
112 |
SELECT util.trim('"$table"', '$map_table') |
|
113 |
EOF |
|
114 |
} |
|
115 |
|
|
116 | 120 |
postprocess() |
117 | 121 |
{ |
118 | 122 |
echo_func; set_make_vars |
Also available in: Unified diff
lib/runscripts/table.run: reordered functions in the order they are called by import()