From bd5acd6b2e47b065c2ca0b985f7ee922982d6d90 Mon Sep 17 00:00:00 2001 From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at> Date: Wed, 9 Mar 2016 15:41:20 +0100 Subject: [PATCH] not creating nodes density table if was imported from db dump --- CHANGELOG.md | 4 ++++ bootstrap/importData.sh | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35ae060..828e44c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +Upcoming version: +----------------- + - not creating nodes density table if was imported from db dump (Nikolaus Krismer) + Version v0.6.0: --------------- - gradle update (to version 2.11) (Nikolaus Krismer) diff --git a/bootstrap/importData.sh b/bootstrap/importData.sh index a49244f..458e3d4 100755 --- a/bootstrap/importData.sh +++ b/bootstrap/importData.sh @@ -160,10 +160,16 @@ function fn_import_dataset_postgis() { fi if $AVAILABLE_POSTGIS && $AVAILABLE_ISOCHRONE_TOOLS; then - ${EXEC_JAVA} -cp "${DEPLOY_DIR}/isochrone-tools.jar" "at.uibk.dbis.isochrone.generator.density.DensityGenerator" -t "${CITY}" -d "${DENSITY}" >> "$WORKING_DIR/create_datamodel_${CITY}_${SRID}.log" 2>&1 - if [ $? -ne 0 ]; then - fn_echo "An error occurred while creating the node_density table for '${CITY}' using isochrone-tools. The process will exit now with status $?" "ERROR" - exit $? + local exists_density=$(PGPASSWORD="$PG_DB_PASSWORD" ${EXEC_PSQL} -qAt -U "$PG_DB_USER" -h localhost -d isochrone -c "SELECT EXISTS (SELECT * FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid=C.relnamespace) WHERE nspname = 'public' AND relname='${CITY}_nodes_density')") + if [ "$exists_density" == "t" ]; then + fn_echo " - nodes_density exists... not re-creating table" + else + fn_echo " - nodes_densities does not exist... creating table" + ${EXEC_JAVA} -cp "${DEPLOY_DIR}/isochrone-tools.jar" "at.uibk.dbis.isochrone.generator.density.DensityGenerator" -t "${CITY}" -d "${DENSITY}" >> "$WORKING_DIR/create_datamodel_${CITY}_${SRID}.log" 2>&1 + if [ $? -ne 0 ]; then + fn_echo "An error occurred while creating the node_density table for '${CITY}' using isochrone-tools. The process will exit now with status $?" "ERROR" + exit $? + fi fi fi -- GitLab