Project

General

Profile

« Previous | Next » 

Revision 9592

bugfix: inputs/GBIF/raw_occurrence_record/run: plant_fraction.table/make(): create the table once with "IF NOT EXISTS" and then populate it with INSERT SELECT, to avoid locking it while it's being repopulated. dropping and recreating the table with CREATE TABLE AS prevented phpMyAdmin from even reading the database's tables list, because it was unable to fetch a rowcount for plant_fraction.

View differences:

inputs/GBIF/raw_occurrence_record/run
17 17
	echo_func; set_make_vars; mk_table_esc
18 18
	
19 19
	use_local_remote
20
	if remaking; then table=plant_fraction table_esc= mk_drop|mysql_ANSI; fi
20
	mysql <<'EOF'
21
CREATE TABLE IF NOT EXISTS `plant_fraction` (
22
 `institution_code` varchar(255) NOT NULL PRIMARY KEY,
23
 `plant_fraction` float NOT NULL
24
)
25
EOF
26
	table=plant_fraction table_esc= mysql_truncate
21 27
	mysql_ANSI <<EOF
22
CREATE TABLE IF NOT EXISTS "plant_fraction" AS
28
INSERT INTO "plant_fraction"
23 29
SELECT
24 30
  institution_code
25 31
, COUNT(family LIKE '%aceae%' OR family IN ('Compositae','Gramineae','Palmae','Guttiferae','Cruciferae','Labiatae','Umbelliferae','Leguminosae'))/COUNT(*)

Also available in: Unified diff