Project

General

Profile

« Previous | Next » 

Revision 9433

inputs/GBIF/raw_occurrence_record/run: store the herbaria filter in a MySQL table loaded from a CSV instead of getting it from a hardcoded list of IN (...) values

View differences:

inputs/GBIF/raw_occurrence_record/run
3 3

  
4 4
if self_not_included; then
5 5

  
6
herbaria_filter.table/make()
7
{
8
	echo_func; set_make_vars
9
	
10
	use_local_remote
11
	local table="$target_stem"
12
	mysql <<'EOF'
13
CREATE TABLE IF NOT EXISTS `herbaria_filter` (
14
 `acronym` varchar(255) NOT NULL,
15
 PRIMARY KEY (`acronym`)
16
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='from IH.vegpath.org?&Index+Herbariorum'
17
EOF
18
	truncate|mysql_ANSI
19
	mysql_import <"$top_dir"/herbaria_filter.csv_
20
}
21

  
6 22
func_override table.tsv/make__src_table_run
7 23
table.tsv/make() # usage: [remake=1] [limit=...] .../run table.tsv/make
8 24
{
9 25
	echo_func; set_make_vars
10 26
	
27
	herbaria_filter.table/make
11 28
	filter="
12 29
deleted IS NULL
13
AND institution_code IN ($(cat "$top_dir"/herbaria.data.sql))" \
30
AND institution_code IN (SELECT * FROM herbaria_filter)" \
14 31
table.tsv/make__src_table_run
15 32
}
16 33

  

Also available in: Unified diff