Project

General

Profile

« Previous | Next » 

Revision 4263

input.Makefile: Staging tables installation: %/install: Also create header.csv so that there is a CSV header that the map spreadsheets can be autogenerated from

View differences:

input.Makefile
177 177
	echo 'DROP SCHEMA IF EXISTS "$(datasrc)" CASCADE;'|$(psqlAsBien)
178 178

  
179 179
# For staging tables which are derived by joining together other staging tables.
180
%/install: %/create.sql _always
180
%/install %/header.csv: %/create.sql _always
181 181
	(echo 'SET search_path TO "$(datasrc)";'; echo 'CREATE TABLE "$*" AS';\
182 182
cat $<; echo ';'; \
183 183
echo 'ALTER TABLE "$*" ADD COLUMN row_num serial NOT NULL PRIMARY KEY;'; \
184 184
echo 'VACUUM ANALYZE "$*";')|$(psqlAsBien) --echo-all
185 185
	(prefix=; . $(bin)/vegbien_dest; env schema=$(datasrc) table=$* \
186 186
errors_table_only=1 $(bin)/csv2db)
187
	echo 'SELECT * FROM "$(datasrc)"."$*" LIMIT 0;'|$(psqlAsBien) \
188
--no-align --field-separator=, --pset=footer=off >$*/header.csv
187 189

  
188 190
# The joined tables must be suffixed with ".src" to prevent the creation of a
189 191
# row_num column, which collides during joins.

Also available in: Unified diff