Revision 9348
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/GBIF/table.run | ||
---|---|---|
4 | 4 |
|
5 | 5 |
if self_not_included; then |
6 | 6 |
|
7 |
table.tsv/make() |
|
7 |
table.tsv/make() # usage: [remake=1] [limit=...] .../run table.tsv/make
|
|
8 | 8 |
{ |
9 | 9 |
echo_func; set_make_vars; check_target_exists |
10 | 10 |
to_target mysql_export_local |
inputs/GBIF/raw_occurrence_record/run | ||
---|---|---|
4 | 4 |
if self_not_included; then |
5 | 5 |
|
6 | 6 |
func_override table.tsv/make__src_table_run |
7 |
table.tsv/make() |
|
7 |
table.tsv/make() # usage: [remake=1] [limit=...] .../run table.tsv/make
|
|
8 | 8 |
{ |
9 | 9 |
echo_func |
10 |
cols=' |
|
11 |
id, institution_code, collection_code, catalogue_number, |
|
12 |
scientific_name, |
|
13 |
family, genus, species, subspecies/*helps TNRS to resolve species*/, |
|
14 |
latitude, longitude, country, state_province, county, locality' \ |
|
15 |
filter=" |
|
16 |
institution_code IN ($(cat "$top_dir"/herbaria.sql))" |
|
17 |
table.tsv/make__src_table_run |
|
10 |
table.tsv/make__src_table_run |
|
18 | 11 |
} |
19 | 12 |
|
20 | 13 |
fi |
lib/sh/make.sh | ||
---|---|---|
13 | 13 |
|
14 | 14 |
if isset rm; then : "${remake:=$rm}"; fi #mnemonic: files are rm'd (overwritten) |
15 | 15 |
|
16 |
# usage: remaking || check if exists |
|
17 |
# cmd line usage: [remake=1] func |
|
16 | 18 |
alias remaking='test "$remake"' |
17 | 19 |
|
18 | 20 |
# usage: set_make_vars; check_target_exists |
lib/sh/db.sh | ||
---|---|---|
18 | 18 |
alias mk_schema_esc='declare schema_esc; mk_esc_name schema' |
19 | 19 |
alias mk_table_esc='declare table_esc; mk_esc_name table' |
20 | 20 |
|
21 |
# export func usage: export_func() { ...; mk_select; ... } |
|
22 |
# caller usage: {query=... | table=... [cols=...] [filter=...]} export_func |
|
23 |
# cmd line usage: [limit=...] caller |
|
21 | 24 |
alias mk_select='mk_table_esc |
22 | 25 |
declare query="$(rtrim "${query:-SELECT ${cols:-*} ${cols:+ |
23 | 26 |
}FROM $table_esc |
... | ... | |
80 | 83 |
} |
81 | 84 |
|
82 | 85 |
mysql_export() # does not support CSV |
86 |
# caller usage: {query=... | table=... [cols=...] [filter=...]} mysql_export |
|
87 |
# cmd line usage: [limit=...] caller |
|
83 | 88 |
{ |
84 | 89 |
echo_func |
85 | 90 |
mk_select |
Also available in: Unified diff
inputs/GBIF/raw_occurrence_record/run table.tsv/make() and functions used by it: added usage comments for cmd line usage, caller usage, and declaring function usage