latest_mmt_version

This commit is contained in:
Deepthi
2021-06-21 12:35:07 +05:30
parent 559fa36e6a
commit b4d396929e
425 changed files with 65022 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,124 @@
#!/bin/bash -e
#Directories
homeDir=$HOME/etl
dataDir=$homeDir/data
backupDir=$homeDir/data/old
configDir=$homeDir/conf
input_file=$configDir/serverCredentials-postgres.txt
declare -A credentials
while IFS="=" read -r key value; do
credentials[$key]=$value
done < <( sed -e '/^\s*$/ d' -e '/^#/ d' $input_file )
for i in ${credentials[@]}; do echo ***$i; done
echo "source user" ${credentials[source_user]}
echo "source user" ${credentials[source_password]}
echo "source user" ${credentials[source_host]}
echo "source user" ${credentials[source_db]}
echo "source user" ${credentials[source_protocol]}
echo "source user" ${credentials[source_server]}
echo "source user" ${credentials[target_user]}
echo "source user" ${credentials[target_password]}
echo "source user" ${credentials[target_host]}
echo "source user" ${credentials[target_db]}
echo "source user" ${credentials[target_protocol]}
echo "source user" ${credentials[target_server]}
source_user=${credentials[source_user]}
source_password=${credentials[source_password]}
source_host=${credentials[source_host]}
source_db=${credentials[source_db]}
source_sch=${credentials[source_sch]}
source_protocol=${credentials[source_protocol]}
source_server=${credentials[source_server]}
target_user=${credentials[target_user]}
target_password=${credentials[target_password]}
target_host=${credentials[target_host]}
target_db=${credentials[target_db]}
target_sch=${credentials[target_sch]}
target_protocol=${credentials[target_protocol]}
target_server=${credentials[target_server]}
control_sch='control'
#source_con="PGOPTIONS=--search_path=source PGPASSWORD=$source_password psql -h $source_host -d $source_db -U $source_user"
#control_con="PGOPTIONS=--search_path=control PGPASSWORD=$target_password psql -h $target_host -d $target_db -U $target_user"
#trx_con="PGOPTIONS=--search_path=trx PGPASSWORD=$target_password psql -h $target_host -d $target_db -U $target_user"
#source_con="psql -X -A -h $source_host -d $source_db -U $source_user -t"
#trx_con="psql -X -A -h $target_host -d $target_db -U $target_user -t"
#control_con="psql -X -A -h $target_host -d $target_db -U $target_user -t"
control_con="psql -X -A -t postgresql://$target_user:$target_password@$target_host/$target_db?options=--search_path%3D$control_sch"
trx_con="psql -X -A -t postgresql://$target_user:$target_password@$target_host/$target_db?options=--search_path%3D$target_sch"
source_con="psql -X -A -t postgresql://$source_user:$source_password@$source_host/$source_db?options=--search_path%3D$source_sch"
process_count=$($control_con -c "select count(process_flag) from trx_ctl_jobrun where process_flag=0;")
$control_con -c "insert into trx_job_log_status(client_id,function_id,job_id) select client_id,function_id,job_id from trx_ctl_jobrun;";
while [ $process_count -gt 0 ]
do
min_dependant_on=$($control_con -c "select min(dependant_on) from trx_ctl_jobrun where process_flag=0 limit 1;")
job_id=$($control_con -c "select job_id from trx_ctl_jobrun where dependant_on=$min_dependant_on and process_flag=0 limit 1;")
source_sql=$($control_con -c "select source_sql from trx_ctl_jobrun where job_id=$job_id;")
source_sql_suffix=$($control_con -c "select source_sql_suffix from trx_ctl_jobrun where job_id=$job_id;")
last_run_date=$($control_con -c "select last_run_date from trx_ctl_jobrun where job_id=$job_id;")
client_id=$($control_con -c "select client_id from trx_ctl_jobrun where job_id=$job_id;")
function_id=$($control_con -c "select function_id from trx_ctl_jobrun where job_id=$job_id;")
transactions=$($control_con -c "select transactions from trx_ctl_jobrun where job_id=$job_id;")
primary_table=$($control_con -c "select primary_table from trx_ctl_jobrun where job_id=$job_id;")
primary_table_id=$($control_con -c "select primary_table_id from trx_ctl_jobrun where job_id=$job_id;")
primary_timestamp=$($control_con -c "select primary_table_timestamp from trx_ctl_jobrun where job_id=$job_id;")
last_run_id=$($control_con -c "select last_run_id from trx_ctl_jobrun where job_id=$job_id;")
target_table=$($control_con -c "select target_table from trx_ctl_jobrun where job_id=$job_id;")
#transactions_to=$(expr "$last_run_id" + "$transactions")
primary_table_max_id=$($source_con -c "select max($primary_table_id) from $primary_table; ")
primary_table_max_time=$($source_con -c "select max($primary_timestamp) from $primary_table where $primary_table_id=$primary_table_max_id ;")
#echo "---- prim $source_con -c select max($primary_timestamp) from $primary_table where $primary_table_id=$primary_table_max_id "
current_timestamp=`date +'%F %T'`
$control_con -c "update trx_job_log_status set job_start_time='$current_timestamp',first_run_id=$last_run_id where job_id=$job_id;"
source_sql=$(echo $source_sql | sed -e "s/last_run_id/$last_run_id/g")
source_sql=$(echo $source_sql | sed -e "s/last_run_date/'$last_run_date'/g")
echo "------$source_sql"
# for nexttime same job have few rows
#echo "---- prim $source_con -c select max($primary_timestamp) from $primary_table where $primary_table_id=$primary_table_max_id "
while [ $primary_table_max_id -gt $last_run_id ]
do
diff=$(expr "$primary_table_max_id" - "$last_run_id")
if [ $diff -lt $transactions ] || [ $transactions -eq 0 ]
then
echo "then"
run_sql="${source_sql} where $primary_table_id>$last_run_id and $primary_timestamp>='$last_run_date'"
run_sql_suffix="${run_sql} ${source_sql_suffix};"
$control_con -c "update trx_ctl_jobrun set last_run_id=$primary_table_max_id ,last_run_date='$primary_table_max_time' where job_id=$job_id;"
last_run_id=$($control_con -c "select last_run_id from trx_ctl_jobrun where job_id=$job_id;")
$source_con -c "$run_sql_suffix">$dataDir/$job_id.csv
$trx_con -c "\copy $target_table from $dataDir/$job_id.csv delimiter '|' NULL AS ''"
# $control_con -e "LOAD DATA LOCAL INFILE '$dataDir/$job_id.csv' INTO TABLE $control_db.$target_table FIELDS TERMINATED BY '\t'"
else
echo "else"
transactions_to=$(expr "$last_run_id" + "$transactions")
primary_table_int_max_time=$($source_con -c "select $primary_timestamp from $primary_table where $primary_table_id=$transactions_to;")
run_sql="${source_sql} where $primary_table_id>$last_run_id and $primary_table_id<=$transactions_to and $primary_timestamp>='$last_run_date';"
run_sql_suffix="${run_sql} ${source_sql_suffix};"
$control_con -c "update trx_ctl_jobrun set last_run_id=$transactions_to,last_run_date='$primary_table_int_max_time' where job_id=$job_id;"
last_run_id=$($control_con -c "select last_run_id from trx_ctl_jobrun where job_id=$job_id;")
$source_con -c "$run_sql_suffix">$dataDir/$job_id.csv
$trx_con -c "\copy $target_table from $dataDir/$job_id.csv delimiter '|' NULL AS ''"
#echo "$control_con -c \copy $target_sch.$target_table from $dataDir/$job_id.csv delimiter '|'"
#$control_con -e "LOAD DATA LOCAL INFILE '$dataDir/$job_id.csv' INTO TABLE $control_db.$target_table FIELDS TERMINATED BY '\t'"
fi
done
current_timestamp=`date +'%F %T'`
$control_con -c "update trx_job_log_status set job_end_time='$current_timestamp',last_run_id=$last_run_id,target_table='$target_table' , job_id=$job_id, duration=EXTRACT(EPOCH FROM (job_end_time-job_start_time)),rows_added=last_run_id-first_run_id where job_status=0 and job_id=$job_id"
$control_con -c "update trx_job_log_status set job_status=1 where job_id=$job_id and job_status=0;"
# $control_con -c "update trx_job_log_status set rows_added=last_run_id-first_run_id where job_id=$job_id;"
$control_con -c "update trx_ctl_jobrun set process_flag=1 where job_id=$job_id;"
process_count=$($control_con -c "select count(process_flag) from trx_ctl_jobrun where process_flag=0;")
done
echo "nothing"

View File

@@ -0,0 +1,6 @@
echo "************ Compiling mmt/onetime folder ************"
echo "************ Errors while compiling are: "
./run_onetime_compile.sh 1>/dev/null
echo "************ Running wrappers ************"
./run_master_wrapper.sh

View File

@@ -0,0 +1,285 @@
drop function if exists fw_core.fn_validation_trx_count;
CREATE OR REPLACE FUNCTION fw_core.fn_validation_trx_count(p_date date)
RETURNS void
LANGUAGE plpgsql
AS $function$
begin
/*
selectfw_core.fn_validation_trx_count ('2021-04-12')
*/
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_arc_perf_atmos_meas_test_block',count(*) from staging2.budni_arc_perf_atmos_meas_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_arc_spec_h1_block',count(*) from staging2.budni_arc_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_arc_test_obs_summary_block',count(*) from staging2.budni_arc_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_other_observations_block',count(*) from staging2.budni_brk_other_observations_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_parking_barke_test_block',count(*) from staging2.budni_brk_parking_barke_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_ballasted_25kmph_block',count(*) from staging2.budni_brk_service_cold_ballasted_25kmph_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_ballasted_maximum_block',count(*) from staging2.budni_brk_service_cold_ballasted_maximum_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_standard_25kmph_block',count(*) from staging2.budni_brk_service_cold_standard_25kmph_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_cold_standard_maximum_block',count(*) from staging2.budni_brk_service_cold_standard_maximum_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_fade_ballasted_25kmph_block',count(*) from staging2.budni_brk_service_fade_ballasted_25kmph_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_service_fade_standard_maximum_block',count(*) from staging2.budni_brk_service_fade_standard_maximum_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_spec_h1_block',count(*) from staging2.budni_brk_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_brk_test_obs_summary_block',count(*) from staging2.budni_brk_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_dbp_drawbar_perf_block',count(*) from staging2.budni_dbp_drawbar_perf_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_dbp_spec_h1_block',count(*) from staging2.budni_dbp_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_fld_cage_wheel_block',count(*) from staging2.budni_fld_cage_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_fld_impl_test_block',count(*) from staging2.budni_fld_impl_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_fld_spec_h1_block',count(*) from staging2.budni_fld_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_fld_sum_perf_test_block',count(*) from staging2.budni_fld_sum_perf_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_fld_test_obs_summary_block',count(*) from staging2.budni_fld_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_lifting_capacity_test_block',count(*) from staging2.budni_hdl_lifting_capacity_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_maintenance_of_lift_load_block',count(*) from staging2.budni_hdl_maintenance_of_lift_load_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_power_test_block',count(*) from staging2.budni_hdl_power_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_spec_h1_block',count(*) from staging2.budni_hdl_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hdl_test_obs_summary_block',count(*) from staging2.budni_hdl_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_perf_test_block',count(*) from staging2.budni_hlg_perf_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_spec_h1_block',count(*) from staging2.budni_hlg_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_hlg_test_obs_summary_block',count(*) from staging2.budni_hlg_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_lcg_gravity_test_block',count(*) from staging2.budni_lcg_gravity_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_lcg_spec_h1_block',count(*) from staging2.budni_lcg_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_atmos_cond_2_block',count(*) from staging2.budni_nmt_atmos_cond_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_meas_results_1_block',count(*) from staging2.budni_nmt_meas_results_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_meas_results_2_block',count(*) from staging2.budni_nmt_meas_results_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_noise_at_bystander_position_block',count(*) from staging2.budni_nmt_noise_at_bystander_position_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_noise_at_operator_ear_level_block',count(*) from staging2.budni_nmt_noise_at_operator_ear_level_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_spec_h1_block',count(*) from staging2.budni_nmt_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_test_obs_summary_block',count(*) from staging2.budni_nmt_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword1_block',count(*) from staging2.budni_pto_mmtkeyword1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword2_block',count(*) from staging2.budni_pto_mmtkeyword2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_pto_perf_report_block',count(*) from staging2.budni_pto_perf_report_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_pto_spec_h1_block',count(*) from staging2.budni_pto_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_pto_summary_block',count(*) from staging2.budni_pto_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_perf_meas_test_block',count(*) from staging2.budni_vmt_perf_meas_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_spec_h1_block',count(*) from staging2.budni_vmt_spec_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','budni_vmt_test_obs_summary_block',count(*) from staging2.budni_vmt_test_obs_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_fuel_consumption_block',count(*) from staging2.dboecd_test_drawbar_performance_fuel_consumption_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_gear_performance_block',count(*) from staging2.dboecd_test_drawbar_performance_gear_performance_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_drawbar_performance_selected_summary_block',count(*) from staging2.dboecd_test_drawbar_performance_selected_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_engine_to_pto_block',count(*) from staging2.dboecd_test_engine_rpm_engine_to_pto_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_required_pull_block',count(*) from staging2.dboecd_test_engine_rpm_required_pull_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_rpm_block',count(*) from staging2.dboecd_test_engine_rpm_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_tyre_details_block',count(*) from staging2.dboecd_test_engine_rpm_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_engine_rpm_weight_block',count(*) from staging2.dboecd_test_engine_rpm_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_h1_block',count(*) from staging2.dboecd_test_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_measurement_uncertainty_block',count(*) from staging2.dboecd_test_measurement_uncertainty_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_remarks_block',count(*) from staging2.dboecd_test_remarks_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_remarks_footer_block',count(*) from staging2.dboecd_test_remarks_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_test_condition_block',count(*) from staging2.dboecd_test_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_test_equipment_used_block',count(*) from staging2.dboecd_test_test_equipment_used_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_cleaner_block',count(*) from staging2.dboecd_test_tractor_specifications_cleaner_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_cylinders_block',count(*) from staging2.dboecd_test_tractor_specifications_cylinders_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_engine_details_block',count(*) from staging2.dboecd_test_tractor_specifications_engine_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_tractor_specifications_fuel_and_injection_block',count(*) from staging2.dboecd_test_tractor_specifications_fuel_and_injection_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_clutch_block',count(*) from staging2.dboecd_test_transmission_clutch_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_drawbar_block',count(*) from staging2.dboecd_test_transmission_drawbar_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_fuel_lubricant_block',count(*) from staging2.dboecd_test_transmission_fuel_lubricant_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_speed_chart_block',count(*) from staging2.dboecd_test_transmission_speed_chart_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_speed_chart_desc_block',count(*) from staging2.dboecd_test_transmission_speed_chart_desc_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dboecd_test_transmission_wheels_block',count(*) from staging2.dboecd_test_transmission_wheels_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_drawbar_performance_gear_performance_block',count(*) from staging2.dbstd_test_drawbar_performance_gear_performance_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_drawbar_performance_selected_summary_block',count(*) from staging2.dbstd_test_drawbar_performance_selected_summary_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_engine_to_pto_block',count(*) from staging2.dbstd_test_engine_rpm_engine_to_pto_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_required_pull_block',count(*) from staging2.dbstd_test_engine_rpm_required_pull_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_rpm_block',count(*) from staging2.dbstd_test_engine_rpm_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_tyre_details_block',count(*) from staging2.dbstd_test_engine_rpm_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_engine_rpm_weight_block',count(*) from staging2.dbstd_test_engine_rpm_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_h1_block',count(*) from staging2.dbstd_test_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_measurement_uncertainty_block',count(*) from staging2.dbstd_test_measurement_uncertainty_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_remarks_block',count(*) from staging2.dbstd_test_remarks_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_remarks_footer_block',count(*) from staging2.dbstd_test_remarks_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_test_condition_block',count(*) from staging2.dbstd_test_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_test_equipment_used_block',count(*) from staging2.dbstd_test_test_equipment_used_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_cleaner_block',count(*) from staging2.dbstd_test_tractor_specifications_cleaner_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_cylinders_block',count(*) from staging2.dbstd_test_tractor_specifications_cylinders_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_engine_details_block',count(*) from staging2.dbstd_test_tractor_specifications_engine_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_tractor_specifications_fuel_and_injection_block',count(*) from staging2.dbstd_test_tractor_specifications_fuel_and_injection_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_clutch_block',count(*) from staging2.dbstd_test_transmission_clutch_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_drawbar_block',count(*) from staging2.dbstd_test_transmission_drawbar_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_fuel_lubricant_block',count(*) from staging2.dbstd_test_transmission_fuel_lubricant_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_speed_chart_block',count(*) from staging2.dbstd_test_transmission_speed_chart_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_speed_chart_desc_block',count(*) from staging2.dbstd_test_transmission_speed_chart_desc_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','dbstd_test_transmission_wheels_block',count(*) from staging2.dbstd_test_transmission_wheels_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_comments_by_block',count(*) from staging2.ftdry_sum_comments_by_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_implement_block',count(*) from staging2.ftdry_sum_implement_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_test_condition_1_block',count(*) from staging2.ftdry_sum_test_condition_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_test_condition_2_block',count(*) from staging2.ftdry_sum_test_condition_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_sum_trac_h1_block',count(*) from staging2.ftdry_sum_trac_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_engine_rpm_block',count(*) from staging2.ftdry_trs_engine_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_h1_block',count(*) from staging2.ftdry_trs_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_implement_block',count(*) from staging2.ftdry_trs_implement_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftdry_trs_spec_block',count(*) from staging2.ftdry_trs_spec_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_comments_by_block',count(*) from staging2.fthlg_sum_comments_by_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_test_condition_1_block',count(*) from staging2.fthlg_sum_test_condition_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_test_condition_2_block',count(*) from staging2.fthlg_sum_test_condition_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_trac_h1_block',count(*) from staging2.fthlg_sum_trac_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_sum_trail_type_block',count(*) from staging2.fthlg_sum_trail_type_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_engine_rpm_block',count(*) from staging2.fthlg_trs_engine_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_h1_block',count(*) from staging2.fthlg_trs_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_spec_block',count(*) from staging2.fthlg_trs_spec_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','fthlg_trs_trailer_block',count(*) from staging2.fthlg_trs_trailer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_cage_wheel_block',count(*) from staging2.ftwet_sum_cage_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_comments_by_block',count(*) from staging2.ftwet_sum_comments_by_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_implement_block',count(*) from staging2.ftwet_sum_implement_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_test_condition_block',count(*) from staging2.ftwet_sum_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_sum_trac_h1_block',count(*) from staging2.ftwet_sum_trac_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_engine_rpm_block',count(*) from staging2.ftwet_trs_engine_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_h1_block',count(*) from staging2.ftwet_trs_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_implement_block',count(*) from staging2.ftwet_trs_implement_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ftwet_trs_spec_block',count(*) from staging2.ftwet_trs_spec_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_footer_block',count(*) from staging2.ihtbt30_bt30_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_h1_block',count(*) from staging2.ihtbt30_bt30_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_condition_block',count(*) from staging2.ihtbt30_bt30_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_1_block',count(*) from staging2.ihtbt30_bt30_test_res_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_2_block',count(*) from staging2.ihtbt30_bt30_test_res_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_3_block',count(*) from staging2.ihtbt30_bt30_test_res_3_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_test_res_4_block',count(*) from staging2.ihtbt30_bt30_test_res_4_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_tyre_details_block',count(*) from staging2.ihtbt30_bt30_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt30_bt30_weight_block',count(*) from staging2.ihtbt30_bt30_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_footer_block',count(*) from staging2.ihtbt50_bt50_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_h1_block',count(*) from staging2.ihtbt50_bt50_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_condition_block',count(*) from staging2.ihtbt50_bt50_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_1_block',count(*) from staging2.ihtbt50_bt50_test_res_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_2_block',count(*) from staging2.ihtbt50_bt50_test_res_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_3_block',count(*) from staging2.ihtbt50_bt50_test_res_3_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_test_res_4_block',count(*) from staging2.ihtbt50_bt50_test_res_4_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_tyre_details_block',count(*) from staging2.ihtbt50_bt50_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbt50_bt50_weight_block',count(*) from staging2.ihtbt50_bt50_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_footer_block',count(*) from staging2.ihtbtd_btd_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_h1_block',count(*) from staging2.ihtbtd_btd_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_condition_block',count(*) from staging2.ihtbtd_btd_test_condition_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_1_block',count(*) from staging2.ihtbtd_btd_test_res_1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_2_block',count(*) from staging2.ihtbtd_btd_test_res_2_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_3_block',count(*) from staging2.ihtbtd_btd_test_res_3_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_4_block',count(*) from staging2.ihtbtd_btd_test_res_4_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_5_block',count(*) from staging2.ihtbtd_btd_test_res_5_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_test_res_6_block',count(*) from staging2.ihtbtd_btd_test_res_6_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_tyre_details_block',count(*) from staging2.ihtbtd_btd_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtbtd_btd_weight_block',count(*) from staging2.ihtbtd_btd_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_footer_block',count(*) from staging2.ihtcgm_cgm_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_h1_block',count(*) from staging2.ihtcgm_cgm_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_lifting_block',count(*) from staging2.ihtcgm_cgm_lifting_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_results_block',count(*) from staging2.ihtcgm_cgm_results_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_tyre_details_block',count(*) from staging2.ihtcgm_cgm_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_weight_block',count(*) from staging2.ihtcgm_cgm_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtcgm_cgm_wheel_block',count(*) from staging2.ihtcgm_cgm_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_brake_pedal_block',count(*) from staging2.ihtemt_emt_brake_pedal_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_footer_block',count(*) from staging2.ihtemt_emt_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_h1_block',count(*) from staging2.ihtemt_emt_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_pedal_block',count(*) from staging2.ihtemt_emt_pedal_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_steering_block',count(*) from staging2.ihtemt_emt_steering_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_tyre_details_block',count(*) from staging2.ihtemt_emt_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_weight_block',count(*) from staging2.ihtemt_emt_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_emt_wheel_block',count(*) from staging2.ihtemt_emt_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtemt_std_raw_data_block',count(*) from staging2.ihtemt_std_raw_data_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_atmos_cond_block',count(*) from staging2.ihtham_ham_atmos_cond_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_drawbar_block',count(*) from staging2.ihtham_ham_drawbar_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_engine_rpm_block',count(*) from staging2.ihtham_ham_engine_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_footer_block',count(*) from staging2.ihtham_ham_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_h1_block',count(*) from staging2.ihtham_ham_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_results_block',count(*) from staging2.ihtham_ham_results_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_tractor_block',count(*) from staging2.ihtham_ham_tractor_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_tyre_details_block',count(*) from staging2.ihtham_ham_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtham_ham_weight_block',count(*) from staging2.ihtham_ham_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_footer_block',count(*) from staging2.ihthls_hls_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_h1_block',count(*) from staging2.ihthls_hls_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_numeric_block',count(*) from staging2.ihthls_hls_numeric_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_tyre_details_block',count(*) from staging2.ihthls_hls_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_weight_block',count(*) from staging2.ihthls_hls_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihthls_hls_wheel_block',count(*) from staging2.ihthls_hls_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_atmos_cond_block',count(*) from staging2.ihtnst_nst_atmos_cond_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_engine_rpm_block',count(*) from staging2.ihtnst_nst_engine_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_footer_block',count(*) from staging2.ihtnst_nst_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_h1_block',count(*) from staging2.ihtnst_nst_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_oel_noise_block',count(*) from staging2.ihtnst_nst_oel_noise_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_oel_noise_load_block',count(*) from staging2.ihtnst_nst_oel_noise_load_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_stand_noise_block',count(*) from staging2.ihtnst_nst_stand_noise_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_tyre_details_block',count(*) from staging2.ihtnst_nst_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtnst_nst_weight_block',count(*) from staging2.ihtnst_nst_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_footer_block',count(*) from staging2.ihtsll_sll_footer_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_forward_block',count(*) from staging2.ihtsll_sll_forward_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_h1_block',count(*) from staging2.ihtsll_sll_h1_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_lead_lag_block',count(*) from staging2.ihtsll_sll_lead_lag_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_reverse_block',count(*) from staging2.ihtsll_sll_reverse_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_tyre_details_block',count(*) from staging2.ihtsll_sll_tyre_details_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_weight_block',count(*) from staging2.ihtsll_sll_weight_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ihtsll_sll_wheel_block',count(*) from staging2.ihtsll_sll_wheel_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_gvg_performance_governing_trails_block',count(*) from staging2.ptoben_gvg_performance_governing_trails_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_mpm_performance_boost_natural_block',count(*) from staging2.ptoben_mpm_performance_boost_natural_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_2hrs_max_power_natural_ambient_block',count(*) from staging2.ptoben_prf_2hrs_max_power_natural_ambient_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_2hrs_max_power_test_high_ambient_block',count(*) from staging2.ptoben_prf_2hrs_max_power_test_high_ambient_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_engine_oil_consumption_block',count(*) from staging2.ptoben_prf_engine_oil_consumption_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_key_performance_parameters_block',count(*) from staging2.ptoben_prf_key_performance_parameters_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_smoke_test_block',count(*) from staging2.ptoben_prf_smoke_test_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_tractor_specs_block',count(*) from staging2.ptoben_prf_tractor_specs_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_load_rated_rpm_block',count(*) from staging2.ptoben_prf_varying_load_rated_rpm_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_load_std_pto_block',count(*) from staging2.ptoben_prf_varying_load_std_pto_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_speed_natural_ambient_block',count(*) from staging2.ptoben_prf_varying_speed_natural_ambient_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'staging2','ptoben_prf_varying_speed_test_high_ambient_block',count(*) from staging2.ptoben_prf_varying_speed_test_high_ambient_block where create_time::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_air_cleaner_perf_results',count(*) from transactional.budni_air_cleaner_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_brake_perf_parking_brake_test_results',count(*) from transactional.budni_brake_perf_parking_brake_test_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_brake_perf_service_brake_test_results',count(*) from transactional.budni_brake_perf_service_brake_test_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_centre_of_gravity_location',count(*) from transactional.budni_centre_of_gravity_location where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_drawbar_perf_results',count(*) from transactional.budni_drawbar_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_field_perf_results',count(*) from transactional.budni_field_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_haulage_perf_results',count(*) from transactional.budni_haulage_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_hydraulic_lifting_capacity_test_results',count(*) from transactional.budni_hydraulic_lifting_capacity_test_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_hydraulic_maint_of_lift_load_results',count(*) from transactional.budni_hydraulic_maint_of_lift_load_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_hydraulic_power_test_results',count(*) from transactional.budni_hydraulic_power_test_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_noise_atmospheric_conditions',count(*) from transactional.budni_noise_atmospheric_conditions where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_noise_measurement_results',count(*) from transactional.budni_noise_measurement_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_pto_perf_results_details',count(*) from transactional.budni_pto_perf_results_details where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_pto_perf_results_summary',count(*) from transactional.budni_pto_perf_results_summary where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_test_observations',count(*) from transactional.budni_test_observations where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','budni_vibration_measurement',count(*) from transactional.budni_vibration_measurement where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','drawbar_perf_observations',count(*) from transactional.drawbar_perf_observations where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','drawbar_perf_oecd_results',count(*) from transactional.drawbar_perf_oecd_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','drawbar_perf_results',count(*) from transactional.drawbar_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','drawbar_perf_results_summary',count(*) from transactional.drawbar_perf_results_summary where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','field_perf_summary',count(*) from transactional.field_perf_summary where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','field_perf_summary_implement_info',count(*) from transactional.field_perf_summary_implement_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','field_perf_summary_tractor_info',count(*) from transactional.field_perf_summary_tractor_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','field_perf_summary_trailer_info',count(*) from transactional.field_perf_summary_trailer_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_brake_pedal_effort',count(*) from transactional.iht_brake_pedal_effort where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_brake_perf_test_condition',count(*) from transactional.iht_brake_perf_test_condition where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_brake_perf_test_results',count(*) from transactional.iht_brake_perf_test_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_cgm_lifting_angle_load_details',count(*) from transactional.iht_cgm_lifting_angle_load_details where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_cgm_results',count(*) from transactional.iht_cgm_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_clutch_pedal_effort',count(*) from transactional.iht_clutch_pedal_effort where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_gear_effort',count(*) from transactional.iht_gear_effort where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_gear_max_speed',count(*) from transactional.iht_gear_max_speed where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_hot_air_mapping_results',count(*) from transactional.iht_hot_air_mapping_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_hyd_lift_sensitivity',count(*) from transactional.iht_hyd_lift_sensitivity where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_noise_measurement_results',count(*) from transactional.iht_noise_measurement_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_noise_measurement_test',count(*) from transactional.iht_noise_measurement_test where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_pedal_effort',count(*) from transactional.iht_pedal_effort where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_speed_lead_lag_measurement',count(*) from transactional.iht_speed_lead_lag_measurement where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_steering_effort',count(*) from transactional.iht_steering_effort where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','iht_steering_effort_raw_data',count(*) from transactional.iht_steering_effort_raw_data where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_engine_oil_consumption',count(*) from transactional.pto_engine_oil_consumption where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_key_perf_parameters',count(*) from transactional.pto_key_perf_parameters where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_multipoint_mapping',count(*) from transactional.pto_multipoint_mapping where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_perf_governing_graph',count(*) from transactional.pto_perf_governing_graph where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_perf_results',count(*) from transactional.pto_perf_results where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','pto_smoke_test',count(*) from transactional.pto_smoke_test where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance',count(*) from transactional.test_instance where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_atmospheric_info',count(*) from transactional.test_instance_atmospheric_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_drawbar_info',count(*) from transactional.test_instance_drawbar_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_engine_info',count(*) from transactional.test_instance_engine_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_equipment_info',count(*) from transactional.test_instance_equipment_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_fuel_lubricant_info',count(*) from transactional.test_instance_fuel_lubricant_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_gear_speed_chart',count(*) from transactional.test_instance_gear_speed_chart where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_images',count(*) from transactional.test_instance_images where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_implement_info',count(*) from transactional.test_instance_implement_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_measurement_uncertainty',count(*) from transactional.test_instance_measurement_uncertainty where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_tractor_info',count(*) from transactional.test_instance_tractor_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_tractor_info_misc',count(*) from transactional.test_instance_tractor_info_misc where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_trailer_info',count(*) from transactional.test_instance_trailer_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_tyre_info',count(*) from transactional.test_instance_tyre_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_weight_reaction',count(*) from transactional.test_instance_weight_reaction where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_instance_wheels_info',count(*) from transactional.test_instance_wheels_info where create_timestamp::date =p_date;
insert into fw_core.run_validation_count(schema_name,table_name,row_count) select 'transactional','test_lab_location_master',count(*) from transactional.test_lab_location_master where create_timestamp::date =p_date;
end
$function$

View File

@@ -0,0 +1,74 @@
drop function if exists fw_core.fn_validation_syspk_count;
CREATE OR REPLACE FUNCTION fw_core.fn_validation_syspk_count(p_date date)
RETURNS void AS $$
begin
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_brake_perf_parking_brake_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_brake_perf_parking_brake_test_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_brake_perf_service_brake_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_brake_perf_service_brake_test_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_centre_of_gravity_location',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_centre_of_gravity_location where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_drawbar_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_drawbar_perf_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_field_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_field_perf_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_haulage_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_haulage_perf_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_hydraulic_lifting_capacity_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_hydraulic_lifting_capacity_test_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_hydraulic_maint_of_lift_load_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_hydraulic_maint_of_lift_load_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_hydraulic_power_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_hydraulic_power_test_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_noise_atmospheric_conditions',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_noise_atmospheric_conditions where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_noise_measurement_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_noise_measurement_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_pto_perf_results_details',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_pto_perf_results_details where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_pto_perf_results_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_pto_perf_results_summary where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_test_observations',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_test_observations where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'budni_vibration_measurement',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.budni_vibration_measurement where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'drawbar_perf_observations',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.drawbar_perf_observations where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'drawbar_perf_oecd_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.drawbar_perf_oecd_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'drawbar_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.drawbar_perf_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'drawbar_perf_results_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.drawbar_perf_results_summary where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'field_perf_summary',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.field_perf_summary where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'field_perf_summary_implement_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.field_perf_summary_implement_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'field_perf_summary_tractor_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.field_perf_summary_tractor_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'field_perf_summary_trailer_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.field_perf_summary_trailer_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_brake_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_brake_pedal_effort where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_brake_perf_test_condition',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_brake_perf_test_condition where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_brake_perf_test_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_brake_perf_test_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_cgm_lifting_angle_load_details',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_cgm_lifting_angle_load_details where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_cgm_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_cgm_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_clutch_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_clutch_pedal_effort where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_gear_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_gear_effort where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_gear_max_speed',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_gear_max_speed where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_hot_air_mapping_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_hot_air_mapping_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_hyd_lift_sensitivity',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_hyd_lift_sensitivity where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_noise_measurement_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_noise_measurement_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_noise_measurement_test',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_noise_measurement_test where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_pedal_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_pedal_effort where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_speed_lead_lag_measurement',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_speed_lead_lag_measurement where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_steering_effort',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_steering_effort where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'iht_steering_effort_raw_data',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.iht_steering_effort_raw_data where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_engine_oil_consumption',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_engine_oil_consumption where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_key_perf_parameters',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_key_perf_parameters where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_multipoint_mapping',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_multipoint_mapping where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_perf_governing_graph',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_perf_governing_graph where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_perf_results',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_perf_results where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'pto_smoke_test',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.pto_smoke_test where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_atmospheric_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_atmospheric_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_drawbar_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_drawbar_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_engine_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_engine_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_equipment_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_equipment_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_fuel_lubricant_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_fuel_lubricant_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_gear_speed_chart',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_gear_speed_chart where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_images',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_images where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_implement_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_implement_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_measurement_uncertainty',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_measurement_uncertainty where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_tractor_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_tractor_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_tractor_info_misc',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_tractor_info_misc where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_trailer_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_trailer_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_tyre_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_tyre_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_weight_reaction',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_weight_reaction where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
insert into fw_core.run_validation_syspk_count(table_name,file_syspk,file_mnemonic,file_sheet_mnemonic,count) select 'test_instance_wheels_info',file_syspk,file_mnemonic,file_sheet_mnemonic,count(*) from transactional.test_instance_wheels_info where create_timestamp::timestamp::date =p_date group by file_syspk,file_mnemonic,file_sheet_mnemonic;
end
$$ LANGUAGE plpgsql;
--select fw_core.fn_validation_syspk_count('2021-05-31')

View File

@@ -0,0 +1,269 @@
drop function if exists staging2.run_master_wrapper;
CREATE OR REPLACE FUNCTION staging2.run_master_wrapper()
RETURNS void AS $$
declare
f record;
stg2_status text;
error_sum int;
err_file_syspk int;
TRX_status text;
begin
for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic,client_id,function_id
from fw_core.fw_jobctl_file_sheet_runschedule where file_sheet_mnemonic !=''
and latest_run_schedule_flag = 1 and end_status != 'error' and end_status_note = 'stg1_completed'--and file_mnemonic not in ('DBOECD','IHTSLL','IHT')
order by file_syspk
loop
if err_file_syspk = f.file_syspk then
--incase of file stg2/trx fail then dont run script for those files and rollback previous change if any.
--rollback for that file syspk needs to be added
continue;
else
--run staging 2 scripts depending on sheet mnemonic
if f.file_sheet_mnemonic = 'FTDRY_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_Block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTDRY_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTWET_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_trs_block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTWET_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTHLG_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_Block('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTHLG_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'DBSTD_TEST' then
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'DBOECD_TEST' then
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOBEN_PRFE','PTOBEN_PRFB','PTOSTD_PRF') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_MPM','PTOSTD_MPM') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_GVG','PTOSTD_GVG') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_BRK' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_FLD' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_HDL' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_NMT' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_HLG' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_PTO' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_VMT' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_ARC' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_DBP' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_LCG' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTCGM_CGM' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTEMT_STD' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTEMT_EMT' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTHAM_HAM' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTHLS_HLS' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTHLS_HLS_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTNST_NST' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTSLL_SLL' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBT30_BT30' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBT50_BT50' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBTD_BTD' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_Block ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''||f.file_sheet_mnemonic||''','||f.file_syspk||')');
else perform fw_core.fn_insert_db_error ( f.function_id, f.function_id, 1001, 'Compegence', f.file_syspk ,f.file_mnemonic,f.file_sheet_mnemonic ,null,'stg2 wrapper', 'unknown block', null, 'no script found', 'Script not present for the particlar sheet mnemonic', null, null,'error');
end if;
-- check if staging 2 script ran correctly and update fw_jobctl_file_sheet_runschedule table.
select e.status from fw_core.db_run_status e where file_syspk = f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic and staging_type = 'stg2' order by error_timestamp desc into stg2_status;
if stg2_status = 'success' then
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg2_completed', end_status='success',staging_type = 'stg2',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'stg2' order by e.error_timestamp desc limit 1)
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
else
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg2_failed', end_status='error',staging_type = 'stg2',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'stg2' order by e.error_timestamp desc limit 1)
, error_description = (select e.error_detail from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'stg2' order by e.error_timestamp desc limit 1)
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
--if error occured store in err_file_syspk variable and go to next file in loop
err_file_syspk := f.file_syspk;
continue;
end if;
--run transactional scripts depending on sheet mnemonic
if f.file_sheet_mnemonic = 'FTDRY_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_TRS_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTDRY_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTDRY_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTWET_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_ftwet_trs_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTWET_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTWET_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTHLG_TRS' then
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_TRS_TRX('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'FTHLG_SUM' then
perform fw_core.fn_get_function_exception('staging2.fn_FTHLG_SUM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'DBSTD_TEST' then
perform fw_core.fn_get_function_exception('staging2.fn_dbstd_test_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'DBOECD_TEST' then
perform fw_core.fn_get_function_exception('staging2.fn_dboecd_test_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOBEN_PRFE','PTOBEN_PRFB','PTOSTD_PRF') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_PRF_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_MPM','PTOSTD_MPM') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_MPM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic in ('PTOBEN_GVG','PTOSTD_GVG') then
perform fw_core.fn_get_function_exception('staging2.fn_PTO_GVG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_BRK' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_BRK_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_FLD' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_FLD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_HDL' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HDL_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_NMT' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_NMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_HLG' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_HLG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_PTO' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_PTO_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_VMT' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_VMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_ARC' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_ARC_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_DBP' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_DBP_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'BUDNI_LCG' then
perform fw_core.fn_get_function_exception('staging2.fn_BUDNI_LCG_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTCGM_CGM' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTCGM_CGM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTEMT_STD' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_STD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTEMT_EMT' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTEMT_EMT_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTHAM_HAM' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTHAM_HAM_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTHLS_HLS' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTHLS_HLS_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTNST_NST' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTNST_NST_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTSLL_SLL' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTSLL_SLL_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBT30_BT30' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT30_BT30_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBT50_BT50' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBT50_BT50_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
elsif f.file_sheet_mnemonic = 'IHTBTD_BTD' then
perform fw_core.fn_get_function_exception('staging2.fn_IHTBTD_BTD_TRX ('||f.client_id||','||f.function_id||','''||f.file_mnemonic||''','''|| f.file_sheet_mnemonic||''','||f.file_syspk||')');
else perform fw_core.fn_insert_db_error ( f.function_id, f.function_id, 1001, 'Compegence', f.file_syspk ,f.file_mnemonic, f.file_sheet_mnemonic ,null,'TRX wrapper', 'unknown TRX', null, 'no script found', null, null, null,'error');
end if;
-- check if transactional script ran correctly and update fw_jobctl_file_sheet_runschedule table.
select e.status from fw_core.db_run_status e where file_syspk = f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic and staging_type = 'trx' order by error_timestamp desc into TRX_status;
if TRX_status = 'success' then
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_completed', end_status='success',staging_type = 'trx',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'trx' order by e.error_timestamp desc limit 1)
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
else
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_failed', end_status='error',staging_type = 'trx',end_time = (select e.error_timestamp from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'trx' order by e.error_timestamp desc limit 1)
, error_description = (select e.error_detail from fw_core.db_run_status e where e.file_syspk=f.file_syspk and e.file_sheet_mnemonic =f.file_sheet_mnemonic and e.staging_type = 'trx' order by e.error_timestamp desc limit 1)
where file_syspk=f.file_syspk and file_sheet_mnemonic =f.file_sheet_mnemonic;
--if error occured store in err_file_syspk variable and go to next file in loop
err_file_syspk := f.file_syspk;
continue;
end if;
end if;
end loop;
-- update fw_jobctl_file_runschedule table.
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'stg2_failed', end_status='error',staging_type = 'stg2' from fw_core.fw_jobctl_file_sheet_runschedule a
where a.latest_run_schedule_flag = 1 and a.end_status = 'error' and a.end_status_note = 'stg2_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_failed', end_status='error',staging_type = 'trx' from fw_core.fw_jobctl_file_sheet_runschedule a
where a.latest_run_schedule_flag = 1 and a.end_status = 'error' and a.end_status_note = 'TRX_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_completed', end_status='success',staging_type = 'trx' from fw_core.fw_jobctl_file_sheet_runschedule a
where a.latest_run_schedule_flag = 1 and a.end_status = 'success' and a.end_status_note ='TRX_completed' and fw_core.fw_jobctl_file_runschedule.end_status !='error' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk;
-- update fw_jobctl_runschedule_jobstep table.
SELECT SUM (case WHEN end_status = 'success' THEN 0
ELSE 1 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_runschedule where latest_run_schedule_flag = 1 INTO error_sum;
if error_sum = 0 then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'run_completed', end_status='success' where latest_run_schedule_flag = true and job_name = 'master load';
else
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'run_failed', end_status='error' where latest_run_schedule_flag = true and job_name = 'master load';
end if;
end;
$$ LANGUAGE plpgsql;
select staging2.run_master_wrapper()
--update after each run
update fw_core.fw_jobctl_file_runschedule set end_status_note = 'stg1_completed';
update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg1_completed';
update fw_core.fw_jobctl_file_runschedule set end_status='success';
update fw_core.fw_jobctl_file_runschedule set staging_type = 'staging1';
update fw_core.fw_jobctl_file_sheet_runschedule set staging_type = 'staging1';
update fw_core.fw_jobctl_file_runschedule set latest_run_schedule_flag = 1;
update fw_core.fw_jobctl_file_sheet_runschedule set file_syspk_error_flag='success';
update fw_core.fw_jobctl_file_sheet_runschedule set end_status='success';
update fw_core.fw_jobctl_file_sheet_runschedule set latest_run_schedule_flag = 1;
update fw_core.fw_jobctl_file_sheet_runschedule set file_syspk_error_flag = 'success';
update fw_core.fw_jobctl_file_sheet_runschedule set error_description = null;
-- changing file sheet mnemonic
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTNST_NST' where file_sheet_mnemonic = 'IHT_NST';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTSLL_SLL' where file_sheet_mnemonic = 'IHT_SLL';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTHAM_HAM' where file_sheet_mnemonic = 'IHT_HAM';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTBRT_BRT' where file_sheet_mnemonic = 'IHT_BRT';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTEMT_EMT' where file_sheet_mnemonic = 'IHT_EMT';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTHLS_HLS' where file_sheet_mnemonic = 'IHT_HLS';
update fw_core.fw_jobctl_file_sheet_runschedule set file_sheet_mnemonic = 'IHTCGM_CGM' where file_sheet_mnemonic = 'IHT_CGM';
--sheet_runshedule
ALTER TABLE fw_core.fw_jobctl_file_sheet_runschedule
RENAME COLUMN latest_flag TO latest_run_schedule_flag;
alter table fw_core.fw_jobctl_file_sheet_runschedule add column end_status text;
alter table fw_core.fw_jobctl_file_sheet_runschedule add column error_description text;
alter table fw_core.fw_jobctl_file_sheet_runschedule add column file_syspk_error_flag text;
alter table fw_core.fw_jobctl_file_sheet_runschedule add column latest_flag int;
update fw_core.fw_jobctl_file_sheet_runschedule set file_syspk_error_flag='success';
update fw_core.fw_jobctl_file_sheet_runschedule set end_status='success';
update fw_core.fw_jobctl_file_sheet_runschedule set latest_run_schedule_flag = 1;
update fw_core.fw_jobctl_file_sheet_runschedule set file_syspk_error_flag = 'success';
--file_runshedule
ALTER TABLE fw_core.fw_jobctl_file_runschedule
RENAME COLUMN latest_flag TO latest_run_schedule_flag;
alter table fw_core.fw_jobctl_file_runschedule add column end_status text;
alter table fw_core.fw_jobctl_file_runschedule add column latest_flag int;
update fw_core.fw_jobctl_file_runschedule set end_status='success';
update fw_core.fw_jobctl_file_runschedule set latest_run_schedule_flag = 1;
--jobstep
ALTER TABLE fw_core.fw_jobctl_runschedule_jobstep
RENAME COLUMN latest_flag TO latest_run_schedule_flag;
alter table fw_core.fw_jobctl_runschedule_jobstep add column end_status text;
update fw_core.fw_jobctl_runschedule_jobstep set latest_run_schedule_flag = true;
insert into fw_core.fw_jobctl_runschedule_jobstep (client_id,function_id,job_name,step_name,end_status,
run_schedule_date,run_frequency,job_id,step_id,job_step_run_dependency_seuqence,data_from_date,
data_to_date,job_script,job_function_name)
values (20,1,'master load','run_master_wrapper','success','31-May-21',1,1,1,1,'31-May-21','31-May-21','','');
delete from fw_core.fw_jobctl_runschedule_jobstep
--update trx in staging_type in file_sheet and file_runshedule
--change run_success to trx_success

View File

@@ -0,0 +1,98 @@
select 'budni_air_cleaner_perf_results',count(*) from transactional.budni_air_cleaner_perf_results;
select 'budni_brake_perf_parking_brake_test_results',count(*) from transactional.budni_brake_perf_parking_brake_test_results;
select 'budni_brake_perf_service_brake_test_results',count(*) from transactional.budni_brake_perf_service_brake_test_results;
select 'budni_centre_of_gravity_location',count(*) from transactional.budni_centre_of_gravity_location;
select 'budni_drawbar_perf_results',count(*) from transactional.budni_drawbar_perf_results;
select 'budni_field_perf_results',count(*) from transactional.budni_field_perf_results;
select 'budni_haulage_perf_results',count(*) from transactional.budni_haulage_perf_results;
select 'budni_hydraulic_lifting_capacity_test_results',count(*) from transactional.budni_hydraulic_lifting_capacity_test_results;
select 'budni_hydraulic_maint_of_lift_load_results',count(*) from transactional.budni_hydraulic_maint_of_lift_load_results;
select 'budni_hydraulic_power_test_results',count(*) from transactional.budni_hydraulic_power_test_results;
select 'budni_noise_atmospheric_conditions',count(*) from transactional.budni_noise_atmospheric_conditions;
select 'budni_noise_measurement_results',count(*) from transactional.budni_noise_measurement_results;
select 'budni_pto_perf_results_details',count(*) from transactional.budni_pto_perf_results_details;
select 'budni_pto_perf_results_summary',count(*) from transactional.budni_pto_perf_results_summary;
select 'budni_test_observations',count(*) from transactional.budni_test_observations;
select 'budni_vibration_measurement',count(*) from transactional.budni_vibration_measurement;
select 'drawbar_perf_noise_measurement_results',count(*) from transactional.drawbar_perf_noise_measurement_results;
select 'drawbar_perf_observations',count(*) from transactional.drawbar_perf_observations;
select 'drawbar_perf_oecd_results',count(*) from transactional.drawbar_perf_oecd_results;
select 'drawbar_perf_results',count(*) from transactional.drawbar_perf_results;
select 'drawbar_perf_results_summary',count(*) from transactional.drawbar_perf_results_summary;
select 'field_perf_summary',count(*) from transactional.field_perf_summary;
select 'field_perf_summary_implement_info',count(*) from transactional.field_perf_summary_implement_info;
select 'field_perf_summary_soil_info',count(*) from transactional.field_perf_summary_soil_info;
select 'field_perf_summary_tractor_info',count(*) from transactional.field_perf_summary_tractor_info;
select 'field_perf_summary_trailer_info',count(*) from transactional.field_perf_summary_trailer_info;
select 'trx',count(*) from transactional.trx;
select 'trx_detailed',count(*) from transactional.trx_detailed;
select 'trx_field',count(*) from transactional.trx_field;
select 'trx_field_sh',count(*) from transactional.trx_field_sh;
select 'trx_mm',count(*) from transactional.trx_mm;
select 'trx_monthly_mmt',count(*) from transactional.trx_monthly_mmt;
select 'trx_pto',count(*) from transactional.trx_pto;
select 'trx_s',count(*) from transactional.trx_s;
select 'trx_sh',count(*) from transactional.trx_sh;
select 'iht_brake_pedal_effort',count(*) from transactional.iht_brake_pedal_effort;
select 'iht_brake_perf_test_condition',count(*) from transactional.iht_brake_perf_test_condition;
select 'iht_brake_perf_test_results',count(*) from transactional.iht_brake_perf_test_results;
select 'iht_cgm_lifting_angle_load_details',count(*) from transactional.iht_cgm_lifting_angle_load_details;
select 'iht_cgm_results',count(*) from transactional.iht_cgm_results;
select 'iht_clutch_pedal_effort',count(*) from transactional.iht_clutch_pedal_effort;
select 'iht_gear_effort',count(*) from transactional.iht_gear_effort;
select 'iht_gear_max_speed',count(*) from transactional.iht_gear_max_speed;
select 'iht_hot_air_mapping_results',count(*) from transactional.iht_hot_air_mapping_results;
select 'iht_hyd_lift_sensitivity',count(*) from transactional.iht_hyd_lift_sensitivity;
select 'iht_noise_measurement_results',count(*) from transactional.iht_noise_measurement_results;
select 'iht_noise_measurement_test',count(*) from transactional.iht_noise_measurement_test;
select 'iht_pedal_effort',count(*) from transactional.iht_pedal_effort;
select 'iht_speed_lead_lag_measurement',count(*) from transactional.iht_speed_lead_lag_measurement;
select 'iht_steering_effort',count(*) from transactional.iht_steering_effort;
select 'iht_steering_effort_raw_data',count(*) from transactional.iht_steering_effort_raw_data;
select 'master_table',count(*) from transactional.master_table;
select 'mmt_column_dq',count(*) from transactional.mmt_column_dq;
select 'source_config',count(*) from transactional.source_config;
select 'mmt_file_sheet_format_master',count(*) from transactional.mmt_file_sheet_format_master;
select 'pto_engine_oil_consumption',count(*) from transactional.pto_engine_oil_consumption;
select 'pto_key_perf_parameters',count(*) from transactional.pto_key_perf_parameters;
select 'pto_multipoint_mapping',count(*) from transactional.pto_multipoint_mapping;
select 'pto_perf_governing_graph',count(*) from transactional.pto_perf_governing_graph;
select 'pto_perf_results',count(*) from transactional.pto_perf_results;
select 'pto_smoke_test',count(*) from transactional.pto_smoke_test;
select 'test_data_file_master',count(*) from transactional.test_data_file_master;
select 'test_instance',count(*) from transactional.test_instance;
select 'test_instance_atmospheric_info',count(*) from transactional.test_instance_atmospheric_info;
select 'test_instance_drawbar_info',count(*) from transactional.test_instance_drawbar_info;
select 'test_instance_engine_info',count(*) from transactional.test_instance_engine_info;
select 'test_instance_equipment_info',count(*) from transactional.test_instance_equipment_info;
select 'test_instance_fuel_lubricant_info',count(*) from transactional.test_instance_fuel_lubricant_info;
select 'test_instance_gear_speed_chart',count(*) from transactional.test_instance_gear_speed_chart;
select 'test_instance_images',count(*) from transactional.test_instance_images;
select 'test_instance_implement_info',count(*) from transactional.test_instance_implement_info;
select 'test_instance_measurement_uncertainty',count(*) from transactional.test_instance_measurement_uncertainty;
select 'test_instance_tractor_info',count(*) from transactional.test_instance_tractor_info;
select 'test_instance_tractor_info_misc',count(*) from transactional.test_instance_tractor_info_misc;
select 'test_instance_trailer_info',count(*) from transactional.test_instance_trailer_info;
select 'test_instance_tyre_info',count(*) from transactional.test_instance_tyre_info;
select 'test_instance_weight_reaction',count(*) from transactional.test_instance_weight_reaction;
select 'test_instance_wheels_info',count(*) from transactional.test_instance_wheels_info;
select 'test_lab_location_master',count(*) from transactional.test_lab_location_master;
select 'test_master',count(*) from transactional.test_master;
select 'zbkp_field_perf_summary_mm_20210507',count(*) from transactional.zbkp_field_perf_summary_mm_20210507;
select 'zbkp_ftdry',count(*) from transactional.zbkp_ftdry;
select 'zbkp_fw_jobctl_file_runschedule_vignesh_2104',count(*) from transactional.zbkp_fw_jobctl_file_runschedule_vignesh_2104;
select 'zbkp_fw_jobctrl_file_sheet_runschedule_vignesh_2104',count(*) from transactional.zbkp_fw_jobctrl_file_sheet_runschedule_vignesh_2104;
select 'zbkp_mmt_file_sheet_format_master',count(*) from transactional.zbkp_mmt_file_sheet_format_master;
select 'zbkp_mmt_file_sheet_format_master_mm_20210420',count(*) from transactional.zbkp_mmt_file_sheet_format_master_mm_20210420;
select 'zbkp_pto_engine_oil_consumption_mm_20210421',count(*) from transactional.zbkp_pto_engine_oil_consumption_mm_20210421;
select 'zbkp_pto_key_perf_parameters_mm_20210421',count(*) from transactional.zbkp_pto_key_perf_parameters_mm_20210421;
select 'zbkp_pto_multipoint_mapping_mm_20210421',count(*) from transactional.zbkp_pto_multipoint_mapping_mm_20210421;
select 'zbkp_pto_perf_governing_graph_mm_20210421',count(*) from transactional.zbkp_pto_perf_governing_graph_mm_20210421;
select 'zbkp_pto_perf_report_details_mm_20210421_discarded',count(*) from transactional.zbkp_pto_perf_report_details_mm_20210421_discarded;
select 'zbkp_pto_perf_report_summary_mm_20210421_discarded',count(*) from transactional.zbkp_pto_perf_report_summary_mm_20210421_discarded;
select 'zbkp_pto_perf_results_mmm_20210421',count(*) from transactional.zbkp_pto_perf_results_mmm_20210421;
select 'zbkp_pto_perf_test_observations_mm_20210421_discarded',count(*) from transactional.zbkp_pto_perf_test_observations_mm_20210421_discarded;
select 'zbkp_pto_smoke_test_mm_20210421',count(*) from transactional.zbkp_pto_smoke_test_mm_20210421;
select 'zbkp_test_data_file_master',count(*) from transactional.zbkp_test_data_file_master;
select 'zbkp_test_data_file_master_mm_20210420',count(*) from transactional.zbkp_test_data_file_master_mm_20210420;
select 'zbkp_test_instance_tractor_info_mm_20210415',count(*) from transactional.zbkp_test_instance_tractor_info_mm_20210415;

View File

@@ -0,0 +1,87 @@
#!/bin/bash -e
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 )
#for i in ${credentials[@]}; do echo ***$i; done
user=${credentials[user]}
password=${credentials[password]}
host=${credentials[host]}
db=${credentials[db]}
protocol=${credentials[protocol]}
server=${credentials[server]}
postgres_con="psql -X -A -t postgresql://$user:$password@$host/$db"
echo "Checking Staging 1 Status"
cdate=$(date +'%Y-%m-%d')
value_count=`$postgres_con -c "select count(*) from fw_core.fw_jobctl_runschedule where end_status='stg1-completed' and end_time::date = date'$cdate%';"`
if [ $value_count == 0 ]
then
echo "Staging 1 process incomplete"
exit
else
echo "Running FTDRY Wrapper"
$postgres_con -c "select staging2.fn_FTDRY_RUN();"
echo "Running FTHLG Wrapper"
$postgres_con -c "select staging2.fn_FTHLG_RUN();"
echo "Running FTWET Wrapper"
$postgres_con -c "select staging2.fn_FTWET_RUN();"
echo "Running Drawbar-DBSTD Wrapper"
$postgres_con -c "select staging2.fn_DBSTD_RUN();"
echo "Running Drawbar-DBOECD Wrapper"
$postgres_con -c "select staging2.fn_DBOECD_RUN();"
echo "Running PTO-PTOSTD Wrapper"
$postgres_con -c "select staging2.fn_PTOSTD_RUN();"
echo "Running PTO-PTOBEN Wrapper"
$postgres_con -c "select staging2.fn_PTOBEN_RUN();"
echo "Running Budni Wrapper"
$postgres_con -c "select staging2.fn_BUDNI_RUN();"
echo "Running IHT-IHTBT30 Wrapper"
$postgres_con -c "select staging2.fn_IHTBT30_RUN();"
echo "Running IHT-IHTBT50 Wrapper"
$postgres_con -c "select staging2.fn_IHTBT50_RUN();"
echo "Running IHT-IHTBT Wrapper"
$postgres_con -c "select staging2.fn_IHTBTD_RUN();"
echo "Running IHT-IHTCGM Wrapper"
$postgres_con -c "select staging2.fn_IHTCGM_RUN();"
echo "Running IHT-IHTEMT Wrapper"
$postgres_con -c "select staging2.fn_IHTEMT_RUN();"
echo "Running IHT-IHTHAM Wrapper"
$postgres_con -c "select staging2.fn_IHTHAM_RUN();"
echo "Running IHT-IHTHSL Wrapper"
$postgres_con -c "select staging2.fn_IHTHSL_RUN();"
echo "Running IHT-IHTNST Wrapper"
$postgres_con -c "select staging2.fn_IHTNST_RUN();"
echo "Running IHT-IHTSLL Wrapper"
$postgres_con -c "select staging2.fn_IHTSLL_RUN();"
echo "Running Archive wrapper"
$postgres_con -c "select archive.fn_block_archive();"
$postgres_con -c "select transactional.fn_info_column_dq('transactional');"
$postgres_con -c "select fw_core.fn_check_model_count('$cdate%');"
$postgres_con -c "select fw_core.fn_table_count ('$cdate%');"
$postgres_con -c "select fw_core.fn_check_mnemonic_count('$cdate%');"
echo "Finished running"
echo "please Check by executing below queries:"
echo " select * from fw_core.db_run_status where error_timestamp::date = date'$cdate%' "
echo " select * from fw_core.fw_jobctl_file_runschedule where run_schedule_date::date = date'$cdate%' "
echo " select * from fw_core.fw_jobctl_file_sheet_runschedule where run_schedule_date::date = date'$cdate%'"
echo " select * from fw_core.check_model_count where create_timestamp::date = date'$cdate%';"
echo " select * from fw_core.check_mnemonic_count where create_time::date =date'$cdate%';"
echo " select * from fw_core.check_table_stg_trx_count where create_time::date =date'$cdate%';"
fi
# $postgres_con -c "select transactional_fn_computation();"

View File

@@ -0,0 +1,65 @@
#!/bin/bash -e
HOME="/home/jagadish"
#Directories
homeDir=$HOME/mmt
configDir=$homeDir/conf
input_file=$configDir/serverCredentials-postgres.txt
declare -A credentials
while IFS="=" read -r key value; do
credentials[$key]=$value
done < <( sed -e '/^\s*$/ d' -e '/^#/ d' $input_file )
for i in ${credentials[@]}; do echo ***$i; done
trx_user=${credentials[trx_user]}
trx_password=${credentials[trx_password]}
trx_host=${credentials[trx_host]}
trx_db=${credentials[trx_db]}
trx_sch=${credentials[trx_sch]}
trx_protocol=${credentials[trx_protocol]}
trx_server=${credentials[trx_server]}
staging2_user=${credentials[staging2_user]}
staging2_password=${credentials[staging2_password]}
staging2_host=${credentials[staging2_host]}
staging2_db=${credentials[staging2_db]}
staging2_sch=${credentials[staging2_sch]}
staging2_protocol=${credentials[staging2_protocol]}
staging2_server=${credentials[staging2_server]}
#satging path Dir
path=$homeDir/onetime/createtables/staging
path=$homeDir/onetime/dataloadfunctions/budni
path=$homeDir/onetime/dataloadfunctions/Drawbar
path=$homeDir/onetime/dataloadfunctions/IHT
path=$homeDir/onetime/dataloadfunctions/field
path=$homeDir/onetime/dataloadfunctions/PTO
path=$homeDir/onetime/wrappers
#trx path Dir
path=$homeDir/onetime/createtables/common
path=$homeDir/onetime/createtables/control
path=$homeDir/onetime/createtables/trx
path=$homeDir/onetime/commonfunctions
path=$homeDir/onetime/configentries
stgpostgres_con="psql -X -A -t postgresql://$staging2_user:$staging2_password@$staging2_host/$staging2_db?options=--search_path%3D$staging2_sch"
trxpostgres_con="psql -X -A -t postgresql://$trx_user:$trx_password@$trx_host/$trx_db?options=--search_path%3D$trx_sch"
func_execute_conn(){
local conn="$1"
local -n param=$2
for path in "${param[@]}"
do
for files in "$path"/*
do
$conn -f $files
done
done
}
#staging:
declare -a stgpathvar=("$homeDir/onetime/createtables/staging")
func_execute_conn "$stg_postgres_con" stgpathvar
#trx:
#declare -a trxpathvar=("$homeDir/onetime/createtables/common" )
#func_execute_conn "$trx_postgres_con" trxpathvar

View File

@@ -0,0 +1,42 @@
drop function if exists staging2.run_post_generic_validation;
CREATE OR REPLACE FUNCTION staging2.run_post_generic_validation()
RETURNS void AS $$
declare
f record;
trx_record_count int;
begin
for f in select distinct file_syspk from fw_core.fw_jobctl_file_runschedule
where latest_run_schedule_flag = 1 and end_status != 'error' and end_status_note = 'stg1_completed'
loop
select count(*) from transactional.test_instance where file_syspk = f.file_syspk into trx_record_count;
if trx_record_count > 0 then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_post_validation_failed', end_status='error';
exit;
end if;
end loop;
end;
$$ LANGUAGE plpgsql;
select staging2.run_post_generic_validation()
drop function if exists staging2.run_trx_post_validation;
CREATE OR REPLACE FUNCTION staging2.run_trx_post_validation()
RETURNS void AS $$
declare
f record;
trx_record_count int;
begin
for f in select distinct file_syspk from fw_core.fw_jobctl_file_runschedule
where latest_run_schedule_flag = 1 and end_status != 'error' and end_status_note = 'trx_completed'
loop
select count(*) from transactional.test_instance where file_syspk = f.file_syspk into trx_record_count;
if trx_record_count = 0 then
update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_post_validation_failed', end_status='error';
exit;
end if;
end loop;
end;
$$ LANGUAGE plpgsql;
select staging2.run_trx_post_validation()

View File

@@ -0,0 +1,25 @@
#!/bin/bash -e
HOME="/home/compegence/customer"
#Directories
homeDir=$HOME/MMT
configDir=$homeDir/conf
openssl enc -aes-256-cbc -d -in $configDir/etl-config.dat > $configDir/etl-config.config -d -pass pass:$1
input_file=$configDir/etl-config.config
declare -A credentials
while IFS="=" read -r key value; do
credentials[$key]=$value
done < <( sed -e '/^\s*$/ d' -e '/^#/ d' $input_file )
for i in ${credentials[@]}; do echo ***$i; done
rm $configDir/etl-config.config
user=${credentials[user]}
password=${credentials[password]}
host=${credentials[host]}
db=${credentials[db]}
protocol=${credentials[protocol]}
server=${credentials[server]}