Revision 8160
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/input.Makefile | ||
---|---|---|
242 | 242 |
(export schema=$(datasrc) table=$*; . $(bin)/vegbien_dest; unset schemas; \ |
243 | 243 |
$(bin)/csv2db) $(logInstall*Add)) |
244 | 244 |
|
245 |
define exportHeader |
|
246 |
$(selfMake) $*/postprocess.sql/run |
|
247 |
echo 'SELECT * FROM "$(datasrc)"."$*" LIMIT 0;'|env no_search_path=1\ |
|
245 |
%/header.csv: |
|
246 |
echo 'SELECT * FROM "$(datasrc)"."$*" LIMIT 0;'|env no_search_path=1 \ |
|
248 | 247 |
$(bin)/psql_script_vegbien --no-align --field-separator=, --pset=footer=off\ |
249 | 248 |
>$*/header.csv |
250 |
endef |
|
251 | 249 |
|
250 |
exportHeader = $(selfMake) $*/header.csv |
|
251 |
|
|
252 | 252 |
# Don't try to edit a view. Must come before %/install to override it. |
253 | 253 |
%_view/install: _always ; |
254 | 254 |
|
... | ... | |
257 | 257 |
($(inDatasrc); echo 'CREATE TABLE "$*" AS'; cat $<; echo ';')|"time" \ |
258 | 258 |
$(psqlNoSearchPath) --echo-all --set=schema='"$(datasrc)"' --set=table='"$*"' \ |
259 | 259 |
$(logInstall*) |
260 |
$(selfMake) $*/postprocess.sql/run |
|
260 | 261 |
$(exportHeader) |
261 | 262 |
$(cleanup) |
262 | 263 |
.PRECIOUS: %/header.csv |
263 | 264 |
|
264 | 265 |
%.sql/run: _always |
265 | 266 |
$(if $(wildcard $(@D)),($(inDatasrc); cat $(@D))|(cd '$(*D)';\ |
266 |
"time" $(psqlNoSearchPath) --set=table='"$(*D)"' --set=table_str=\''"$(*D)"'\')) |
|
267 |
"time" env no_search_path=1 ../$(bin)/psql_verbose_vegbien \ |
|
268 |
--set=table='"$(*D)"' --set=table_str=\''"$(*D)"'\')) |
|
267 | 269 |
|
268 | 270 |
%/install: _always |
269 | 271 |
$(if $(nonXml),$(import_install_)) |
272 |
$(selfMake) $*/postprocess.sql/run |
|
270 | 273 |
$(exportHeader) |
271 | 274 |
$(cleanup) |
272 | 275 |
define import_install_ |
Also available in: Unified diff
inputs/input.Makefile: Moved postprocess.sql from $(exportHeader) to %/install because that is not part of the $(exportHeader) functionality. Added %/header.csv and use it in $(exportHeader).