1
0
Fork 0

Update updateProductionViews.sh

This commit is contained in:
dimitrispie 2023-07-13 15:48:12 +03:00
parent aedd279f78
commit 706092bc19
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ export SOURCE=$1
export PRODUCTION=$2 export PRODUCTION=$2
echo "Updating ${PRODUCTION} database" echo "Updating ${PRODUCTION} database"
impala-shell -q "create database if not exists ${PRODUCTION}" impala-shell -i impala-cluster-dn1.openaire.eu -q "create database if not exists ${PRODUCTION}"
impala-shell -d ${PRODUCTION} -q "show tables" --delimited | sed "s/^/drop view if exists ${PRODUCTION}./" | sed "s/$/;/" | impala-shell -c -f - impala-shell -i impala-cluster-dn1.openaire.eu -d ${PRODUCTION} -q "show tables" --delimited | sed "s/^/drop view if exists ${PRODUCTION}./" | sed "s/$/;/" | impala-shell -i impala-cluster-dn1.openaire.eu -c -f -
impala-shell -d ${SOURCE} -q "show tables" --delimited | sed "s/\(.*\)/create view ${PRODUCTION}.\1 as select * from ${SOURCE}.\1;/" | impala-shell -c -f - impala-shell -i impala-cluster-dn1.openaire.eu -d ${SOURCE} -q "show tables" --delimited | sed "s/\(.*\)/create view ${PRODUCTION}.\1 as select * from ${SOURCE}.\1;/" | impala-shell -i impala-cluster-dn1.openaire.eu -c -f -
echo "Production db ready!" echo "Production db ready!"