mmt sql
This commit is contained in:
60
scripts/correlation.sh
Executable file
60
scripts/correlation.sh
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#/****************************************************************
|
||||
#****** ForeWarn Licensing and / or usage Terms and Conditions *****
|
||||
#ForeWarn. The NextGen Insights Solution Platform
|
||||
|
||||
#Copyright ¿ 2021 COMPEGENCE. All Rights Reserved
|
||||
|
||||
#ForeWarn is a product of COMPEGENCE.
|
||||
|
||||
#To be used only with a valid license from COMPEGENCE
|
||||
|
||||
#www.compegence.com info@compegence.com
|
||||
#****************************************************************/
|
||||
|
||||
HOME="/home/compegence/customer"
|
||||
#Directories
|
||||
homeDir=$HOME/MMT
|
||||
configDir=$homeDir/conf
|
||||
input_file=$configDir/etl-config.txt
|
||||
declare -A credentials
|
||||
while IFS="=" read -r key value; do
|
||||
credentials[$key]=$value
|
||||
done < <( sed -e '/^\s*$/ d' -e '/^#/ d' $input_file )
|
||||
|
||||
|
||||
user=${credentials[user]}
|
||||
password=${credentials[password]}
|
||||
host=${credentials[host]}
|
||||
db=${credentials[db]}
|
||||
protocol=${credentials[protocol]}
|
||||
server=${credentials[server]}
|
||||
|
||||
|
||||
psql_base_arg="postgresql://$user:$password@$host/$db"
|
||||
|
||||
#update fw_jobctl_file_landing
|
||||
|
||||
|
||||
##get file mnemonic count
|
||||
file_mnemonic_count_drawbar=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag=true and file_mnemonic like 'DB%' ;")
|
||||
echo "file-mnemonic-count is $file_mnemonic_count_drawbar"
|
||||
|
||||
if [[ $file_mnemonic_count_drawbar -gt 0 ]]; then
|
||||
psql $psql_base_arg -t -c "select fw_ods.drawbar_correlation_upload()"
|
||||
# else
|
||||
# exit 1;
|
||||
fi
|
||||
|
||||
file_mnemonic_count_pto=$(psql $psql_base_arg -t -c "select count(*) from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag=true and file_mnemonic like 'PTO%';")
|
||||
echo "file-mnemonic-count_pto is $file_mnemonic_count_pto"
|
||||
|
||||
if [[ $file_mnemonic_count_pto -gt 0 ]]; then
|
||||
psql $psql_base_arg -t -c "select fw_ods.pto_correlation_upload()"
|
||||
# else
|
||||
# exit 1;
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user