Revision 8282
Added by Aaron Marcuse-Kubitza almost 12 years ago
lib/table.run | ||
---|---|---|
8 | 8 |
|
9 | 9 |
import () |
10 | 10 |
{ |
11 |
echo_func "$FUNCNAME" "$@" |
|
11 | 12 |
before_import_cmds |
12 | 13 |
"$(dirname "${BASH_SOURCE[0]}")"/path/to/table.run import |
13 | 14 |
after_import_cmds |
... | ... | |
27 | 28 |
|
28 | 29 |
psql () # usage: ([file=...] [dir=...]; self) |
29 | 30 |
{ |
31 |
echo_func "$FUNCNAME" "$@" |
|
30 | 32 |
local dir="$dir" |
31 | 33 |
if test -n "$file"; then |
32 | 34 |
set -- --file "$file" "$@" |
... | ... | |
47 | 49 |
|
48 | 50 |
input_make () |
49 | 51 |
{ |
52 |
echo_func "$FUNCNAME" "$@" |
|
50 | 53 |
echo_run env make --directory="$top_dir"/.. "${@/#/$table/}" |
51 | 54 |
} |
52 | 55 |
|
53 | 56 |
map_table () |
54 | 57 |
{ |
58 |
echo_func "$FUNCNAME" "$@" |
|
55 | 59 |
input_make map.csv |
56 | 60 |
psql <<EOF |
57 | 61 |
SELECT util.reset_map_table('pg_temp.map'); |
... | ... | |
60 | 64 |
EOF |
61 | 65 |
} |
62 | 66 |
|
63 |
mk_derived () { "$root_dir"/schemas/VegCore/mk_derived; } |
|
67 |
mk_derived () |
|
68 |
{ |
|
69 |
echo_func "$FUNCNAME" "$@" |
|
70 |
"$root_dir"/schemas/VegCore/mk_derived |
|
71 |
} |
|
64 | 72 |
|
65 | 73 |
remake_VegBIEN_mappings () |
66 | 74 |
{ |
75 |
echo_func "$FUNCNAME" "$@" |
|
67 | 76 |
echo_run rm header.csv map.csv # remake them |
68 | 77 |
yes|input_make test |
69 | 78 |
} |
70 | 79 |
|
71 | 80 |
postprocess () # overridable |
72 | 81 |
{ |
82 |
echo_func "$FUNCNAME" "$@" |
|
73 | 83 |
local file="$top_dir"/postprocess.sql |
74 | 84 |
if test -e "$file"; then psql "$@"; fi |
75 | 85 |
} |
76 | 86 |
|
77 | 87 |
import () |
78 | 88 |
{ |
79 |
echo_run map_table |
|
80 |
echo_run postprocess |
|
81 |
echo_run mk_derived |
|
89 |
echo_func "$FUNCNAME" "$@" |
|
90 |
map_table |
|
91 |
postprocess |
|
92 |
mk_derived |
|
82 | 93 |
} |
83 | 94 |
|
84 | 95 |
run_cmd "$@" |
Also available in: Unified diff
lib/table.run: Switched from echo_run to echo_func