Project

General

Profile

« Previous | Next » 

Revision 5795

input.Makefile: Staging tables installation: $(cleanup): If a cleanup.sql is provided, only run it and don't do default cleanup, to allow tables to override rather than just add to default cleanup operations. This prevents the automatic replacement of certain strings (sql_io.null_strs) with NULL on TNRS, and keeps the TNRS cache mostly as it was output by the TNRS service. Note that empty strings are still replaced with NULL by COPY FROM in sql_io.append_csv(). This is necessary for TNRS import to work properly, because although '' generally means NULL, it is not treated that way by PostgreSQL.

View differences:

input.Makefile
214 214
%.sql: _MySQL/%.sql
215 215
	$(bin)/my2pg <$< >$@
216 216

  
217
define cleanup
218
(prefix=; . $(bin)/vegbien_dest; env schema=$(datasrc) table=$* $(bin)/csv2db) \
219
$(logInstall*Add)
220
$(if $(wildcard $*/cleanup.sql),($(inDatasrc); cat $*/cleanup.sql;)|"time" \
221
$(psqlAsBien) --echo-all --set=table='"$*"' $(logInstall*Add))
222
endef
217
cleanup = $(if $(wildcard $*/cleanup.sql),($(inDatasrc); cat $*/cleanup.sql)\
218
|"time" $(psqlAsBien) --echo-all --set=table='"$*"' $(logInstall*Add),\
219
(prefix=; . $(bin)/vegbien_dest; env schema=$(datasrc) table=$* $(bin)/csv2db)\
220
$(logInstall*Add))
223 221

  
224 222
define exportHeader
225 223
$(cleanup)

Also available in: Unified diff