deletedextrafiles
This commit is contained in:
@@ -1,243 +0,0 @@
|
|||||||
drop function if exists mmt_staging2.fn_FTDRY_SUM_ODS ;
|
|
||||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTDRY_SUM_ODS()
|
|
||||||
RETURNS void AS $$
|
|
||||||
begin
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_tractor_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_engine_hp,
|
|
||||||
rated_rpm,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_front_kg,
|
|
||||||
tractor_weight_rear_kg,
|
|
||||||
tractor_weight_total_kg,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_engine_hp::float,
|
|
||||||
rated_rpm::int,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_kg_front::int,
|
|
||||||
tractor_weight_kg_rear::int,
|
|
||||||
tractor_weight_kg_total::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_sum_trac_h1_block where tractor_model<> ''0''';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_implement_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
make_of_implement,
|
|
||||||
implement_type,
|
|
||||||
implement_size,
|
|
||||||
hitch_category,
|
|
||||||
implement_weight,
|
|
||||||
soil_type,
|
|
||||||
soil_moisture_content_pct,
|
|
||||||
soil_bulk_density_g_per_cc,
|
|
||||||
soil_cone_index,
|
|
||||||
field_condition,
|
|
||||||
season,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
make_of_implement,
|
|
||||||
implement_type,
|
|
||||||
implement_size,
|
|
||||||
hitch_category,
|
|
||||||
implement_weight::int,
|
|
||||||
soil_type,
|
|
||||||
moisture_content::int soil_moisture_content_pct,
|
|
||||||
bulk_density_g_cc::int soil_bulk_density_g_per_cc,
|
|
||||||
soil_cone_index::int soil_cone_index,
|
|
||||||
field_condition,
|
|
||||||
season,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_sum_implement_block';
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date,
|
|
||||||
tractor_model,
|
|
||||||
engine_rpm_set,
|
|
||||||
pto_rpm_set,
|
|
||||||
gear_used,
|
|
||||||
nominal_speed_kmph,
|
|
||||||
engine_rpm_drop_on_straight_1st_pass,
|
|
||||||
engine_rpm_drop_on_turn_1st_pass,
|
|
||||||
depth_of_cut_cm,
|
|
||||||
no_load_speed_kmph,
|
|
||||||
on_load_speed_kmph,
|
|
||||||
wheel_slippage_pct,
|
|
||||||
fuel_consumption_lit_per_hr,
|
|
||||||
area_covered_acr_per_hr,
|
|
||||||
fuel_consumption_lit_per_acr,
|
|
||||||
fuel_consumption_var_lit_per_hr,
|
|
||||||
area_covered_var_acr_per_hr,
|
|
||||||
fuel_consumption_var_lit_per_acr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke,
|
|
||||||
draft_response,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_wheel_dragging_at_turning,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
implement_lifting_per_lowering_response,
|
|
||||||
pulverization_index,
|
|
||||||
pulverization_quality,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date::date,
|
|
||||||
tractor_model,
|
|
||||||
engine_rpm_set::int,
|
|
||||||
pto_rpm_set::int,
|
|
||||||
gear_used,
|
|
||||||
nominal_speed_kmph::float,
|
|
||||||
engine_rpm_drop_on_straight engine_rpm_drop_on_straight_1st_pass ,
|
|
||||||
engine_rpm_drop_on_turn engine_rpm_drop_on_turn_1st_pass,
|
|
||||||
depth_of_cut_cm,
|
|
||||||
no_load_speed_kmph::int,
|
|
||||||
on_load_speed_kmph::int,
|
|
||||||
wheel_slippage_::int wheel_slippage_pct,
|
|
||||||
fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
|
|
||||||
area_covered_acr_hr::int area_covered_acr_per_hr,
|
|
||||||
fuel_consumption_lit_acr::float fuel_consumption_lit_per_acr ,
|
|
||||||
case when fuel_consumption_lit_hr_2 ~ E''^\\d+$'' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr,
|
|
||||||
case when area_covered_acr_hr_2 ~ E''^\\d+$'' then area_covered_acr_hr_2::int else null end as area_covered_var_acr_per_hr ,
|
|
||||||
case when fuel_consumption_lit_acr_2 ~ E''^\\d+$'' then fuel_consumption_lit_acr_2::int else null end as fuel_consumption_var_lit_per_acr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke ,
|
|
||||||
draft_response,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_performance tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_wheel_dragging_at_turning,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
implement_lifting_lowering_response implement_lifting_per_lowering_response,
|
|
||||||
pulverization_index,
|
|
||||||
pulverization_quality,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_sum_test_condition_1_block where engine_rpm_set <> ''0''';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date,
|
|
||||||
tractor_model,
|
|
||||||
engine_rpm_set,
|
|
||||||
pto_rpm_set,
|
|
||||||
gear_used,
|
|
||||||
nominal_speed_kmph,
|
|
||||||
engine_rpm_drop_on_straight_1st_pass,
|
|
||||||
engine_rpm_drop_on_turn_1st_pass,
|
|
||||||
depth_of_cut_cm,
|
|
||||||
no_load_speed_kmph,
|
|
||||||
on_load_speed_kmph,
|
|
||||||
wheel_slippage_pct,
|
|
||||||
fuel_consumption_lit_per_hr,
|
|
||||||
area_covered_acr_per_hr,
|
|
||||||
fuel_consumption_lit_per_acr,
|
|
||||||
fuel_consumption_var_lit_per_hr,
|
|
||||||
area_covered_var_acr_per_hr,
|
|
||||||
fuel_consumption_var_lit_per_acr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke,
|
|
||||||
draft_response,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_wheel_dragging_at_turning,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
implement_lifting_per_lowering_response,
|
|
||||||
pulverization_index,
|
|
||||||
pulverization_quality,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date::date,
|
|
||||||
tractor_model,
|
|
||||||
engine_rpm_set::int,
|
|
||||||
pto_rpm_set::int,
|
|
||||||
gear_used,
|
|
||||||
nominal_speed_kmph::float,
|
|
||||||
engine_rpm_drop_on_straight engine_rpm_drop_on_straight_1st_pass ,
|
|
||||||
engine_rpm_drop_on_turn engine_rpm_drop_on_turn_1st_pass,
|
|
||||||
depth_of_cut_cm,
|
|
||||||
no_load_speed_kmph::int,
|
|
||||||
on_load_speed_kmph::int,
|
|
||||||
wheel_slippage_::int wheel_slippage_pct,
|
|
||||||
fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
|
|
||||||
area_covered_acr_hr::int area_covered_acr_per_hr,
|
|
||||||
fuel_consumption_lit_acr::float fuel_consumption_lit_per_acr ,
|
|
||||||
case when fuel_consumption_lit_hr_2 ~ E''^\\d+$'' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr,
|
|
||||||
case when area_covered_acr_hr_2 ~ E''^\\d+$'' then area_covered_acr_hr_2::int else null end as area_covered_var_acr_per_hr ,
|
|
||||||
case when fuel_consumption_lit_acr_2 ~ E''^\\d+$'' then fuel_consumption_lit_acr_2::int else null end as fuel_consumption_var_lit_per_acr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke ,
|
|
||||||
draft_response,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_performance tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_wheel_dragging_at_turning,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
implement_lifting_lowering_response implement_lifting_per_lowering_response,
|
|
||||||
pulverization_index,
|
|
||||||
pulverization_quality,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_sum_test_condition_2_block where engine_rpm_set <> ''0''';
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
select mmt_staging2.fn_FTDRY_SUM_ODS();
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,229 +0,0 @@
|
|||||||
drop function if exists mmt_staging2.fn_FTHLG_SUM_ODS ;
|
|
||||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTHLG_SUM_ODS()
|
|
||||||
RETURNS void AS $$
|
|
||||||
begin
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_tractor_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_engine_hp,
|
|
||||||
rated_rpm,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_front_kg,
|
|
||||||
tractor_weight_rear_kg,
|
|
||||||
tractor_weight_total_kg,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make ,
|
|
||||||
tractor_engine_hp::int,
|
|
||||||
rated_rpm::int,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_kg_front::int tractor_weight_front_kg,
|
|
||||||
tractor_weight_kg_rear::int tractor_weight_rear_kg,
|
|
||||||
tractor_weight_kg_total::int tractor_weight_total_kg,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.fthlg_sum_trac_h1_block where tractor_model<> ''0''';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_trailer_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
trailer_type,
|
|
||||||
tire_size_and_inflation_pressure_psi,
|
|
||||||
no_of_axle,
|
|
||||||
no_of_wheels,
|
|
||||||
trailer_gross_weight_kg,
|
|
||||||
tractor_rwc_to_hitch_point_center_dist_mm,
|
|
||||||
tractor_hitch_height_from_ground_mm,
|
|
||||||
trailer_hitch_height_above_ground_level_mm,
|
|
||||||
gradient_slope_1_degree,
|
|
||||||
gradient_slope_2_degree,
|
|
||||||
tractor_hitch_type,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Trailer_Type,
|
|
||||||
Tire_size_and_inflation_pressure_psi,
|
|
||||||
No_Of_Axle::int ,
|
|
||||||
No_Of_Wheels::int,
|
|
||||||
Trailer_Gross_Weight_Kg::int,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm::int,
|
|
||||||
Tractor_Hitch_Height_from_Ground_mm::int,
|
|
||||||
Trailer_hitch_Height_above_ground_level_mm::int,
|
|
||||||
Gradient_Slope_1_Degree::int,
|
|
||||||
Gradient_Slope_2_degree::int,
|
|
||||||
Tractor_Hitch_Type,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.FTHLG_SUM_Trail_Type_Block';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date,
|
|
||||||
tractor_model,
|
|
||||||
fuel_consumption_lit_per_hr,
|
|
||||||
mileage_km_per_ltr,
|
|
||||||
avg_speed_of_travel_kmph,
|
|
||||||
total_dist_travelled_km,
|
|
||||||
gear_used_on_straight_road,
|
|
||||||
straight_road_rpm_drop,
|
|
||||||
gear_used_on_up_slope_1,
|
|
||||||
up_slope_rpm_drop_1,
|
|
||||||
gear_used_on_up_slope_2,
|
|
||||||
up_slope_rpm_drop_2,
|
|
||||||
gear_used_on_down_slope,
|
|
||||||
down_slope_rpm_shoot_up,
|
|
||||||
fuel_consumption_var_lit_per_hr,
|
|
||||||
mileage_var_km_per_ltr,
|
|
||||||
fuel_consumption_var_pct_lit_per_hr,
|
|
||||||
mileage_var_pct_km_per_ltr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke,
|
|
||||||
range_gear_shifting,
|
|
||||||
speed_gear_shifting,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date::date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr::float fuel_consumption_lit_per_hr ,
|
|
||||||
Mileage_Km_Ltr ::float mileage_km_per_ltr ,
|
|
||||||
Average_speed_of_travel_kmph::float avg_speed_of_travel_kmph ,
|
|
||||||
Total_distance_travelled_km::int total_dist_travelled_km ,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1 ,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
case when fuel_consumption_lit_hr_2 ~ E''^\\d+$'' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr ,
|
|
||||||
case when Mileage_Km_Ltr_2 ~ E''^\\d+$'' then Mileage_Km_Ltr_2::int else null end as mileage_var_km_per_ltr,
|
|
||||||
case when fuel_consumption_lit_hr_3 ~ E''^\\d+$'' then fuel_consumption_lit_hr_3::int else null end as fuel_consumption_var_pct_lit_per_hr ,
|
|
||||||
case when Mileage_Km_Ltr_3 ~ E''^\\d+$'' then Mileage_Km_Ltr_3::int else null end as mileage_var_pct_km_per_ltr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance tractor_braking_perf ,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.fthlg_sum_test_condition_1_block where Gear_used_on_Straight_Road not in (''0'',''0.000'')';
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_condition,
|
|
||||||
test_date,
|
|
||||||
tractor_model,
|
|
||||||
fuel_consumption_lit_per_hr,
|
|
||||||
mileage_km_per_ltr,
|
|
||||||
avg_speed_of_travel_kmph,
|
|
||||||
total_dist_travelled_km,
|
|
||||||
gear_used_on_straight_road,
|
|
||||||
straight_road_rpm_drop,
|
|
||||||
gear_used_on_up_slope_1,
|
|
||||||
up_slope_rpm_drop_1,
|
|
||||||
gear_used_on_up_slope_2,
|
|
||||||
up_slope_rpm_drop_2,
|
|
||||||
gear_used_on_down_slope,
|
|
||||||
down_slope_rpm_shoot_up,
|
|
||||||
fuel_consumption_var_lit_per_hr,
|
|
||||||
mileage_var_km_per_ltr,
|
|
||||||
fuel_consumption_var_pct_lit_per_hr,
|
|
||||||
mileage_var_pct_km_per_ltr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
engine_acceleration_smoke,
|
|
||||||
range_gear_shifting,
|
|
||||||
speed_gear_shifting,
|
|
||||||
tractor_steer_ability,
|
|
||||||
tractor_braking_perf,
|
|
||||||
front_visibility,
|
|
||||||
implement_accessibility,
|
|
||||||
front_end_lifting_during_operation,
|
|
||||||
rpm_recovery_time,
|
|
||||||
engine_vibration,
|
|
||||||
engine_sound,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date::date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr::float fuel_consumption_lit_per_hr ,
|
|
||||||
Mileage_Km_Ltr ::float mileage_km_per_ltr ,
|
|
||||||
Average_speed_of_travel_kmph::float avg_speed_of_travel_kmph ,
|
|
||||||
Total_distance_travelled_km::int total_dist_travelled_km ,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1 ,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
case when fuel_consumption_lit_hr_2 ~ E''^\\d+$'' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr ,
|
|
||||||
case when Mileage_Km_Ltr_2 ~ E''^\\d+$'' then Mileage_Km_Ltr_2::int else null end as mileage_var_km_per_ltr,
|
|
||||||
case when fuel_consumption_lit_hr_3 ~ E''^\\d+$'' then fuel_consumption_lit_hr_3::int else null end as fuel_consumption_var_pct_lit_per_hr ,
|
|
||||||
case when Mileage_Km_Ltr_3 ~ E''^\\d+$'' then Mileage_Km_Ltr_3::int else null end as mileage_var_pct_km_per_ltr,
|
|
||||||
engine_smoke_on_load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance tractor_braking_perf ,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.fthlg_sum_test_condition_2_block where Gear_used_on_Straight_Road not in (''0'',''0.000'')';
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
select mmt_staging2.fn_FTHLG_SUM_ODS ();
|
|
||||||
|
|
||||||
@@ -1,189 +0,0 @@
|
|||||||
drop function if exists mmt_staging2.fn_FTWET_SUM_ODS ;
|
|
||||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTWET_SUM_ODS()
|
|
||||||
RETURNS void AS $$
|
|
||||||
begin
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_tractor_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_engine_hp,
|
|
||||||
rated_rpm,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_front_kg,
|
|
||||||
tractor_weight_rear_kg,
|
|
||||||
tractor_weight_total_kg,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_engine_hp::float,
|
|
||||||
rated_rpm::int,
|
|
||||||
transmission_type,
|
|
||||||
wheel_drive_type,
|
|
||||||
fip_type,
|
|
||||||
steering_type,
|
|
||||||
tractor_weight_kg_front::int,
|
|
||||||
tractor_weight_kg_rear::int,
|
|
||||||
tractor_weight_kg_total::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftwet_sum_trac_h1_block where tractor_model<> ''0''';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_implement_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
make_of_implement,
|
|
||||||
implement_type,
|
|
||||||
implement_size,
|
|
||||||
hitch_category,
|
|
||||||
implement_weight,
|
|
||||||
soil_type,
|
|
||||||
soil_moisture_content_pct,
|
|
||||||
soil_bulk_density_g_per_cc,
|
|
||||||
soil_cone_index,
|
|
||||||
field_condition,
|
|
||||||
season,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
make_of_implement,
|
|
||||||
implement_type,
|
|
||||||
implement_size,
|
|
||||||
hitch_category,
|
|
||||||
implement_weight::int,
|
|
||||||
soil_type,
|
|
||||||
moisture_content::int soil_moisture_content_pct,
|
|
||||||
bulk_density_g_cc::int soil_bulk_density_g_per_cc,
|
|
||||||
soil_cone_index::int soil_cone_index,
|
|
||||||
field_condition,
|
|
||||||
season,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftwet_sum_implement_block';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary_implement_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
type_of_cage_wheel,
|
|
||||||
cage_wheel_width_mm,
|
|
||||||
cage_wheel_weight,
|
|
||||||
cage_wheel_inner_and_outer_ring_dia_mm,
|
|
||||||
cage_wheel_center_ring_dia_mm,
|
|
||||||
dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm,
|
|
||||||
no_of_angles_on_cage_wheel,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Type_of_Cage_Wheel,
|
|
||||||
Cage_Wheel_Width_mm::int,
|
|
||||||
Cage_wheel_Weight::int,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_inner_and_outer_ring_dia_mm ,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm::int,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm::int dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm ,
|
|
||||||
No_of_angles_on_cage_wheel::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.FTWET_SUM_Cage_Wheel_Block';
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.field_perf_summary
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass,
|
|
||||||
No_of_passes,
|
|
||||||
depth_of_cut_cm,
|
|
||||||
fuel_consumption_lit_per_hr,
|
|
||||||
area_covered_acr_per_hr,
|
|
||||||
fuel_consumption_lit_per_acr,
|
|
||||||
fuel_consumption_var_lit_per_hr,
|
|
||||||
area_covered_var_acr_per_hr,
|
|
||||||
fuel_consumption_var_lit_per_acr,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_perf,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
implement_lifting_per_lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date::date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set::float,
|
|
||||||
PTO_RPM_set::int,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH::float,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass,
|
|
||||||
No_of_passes::int,
|
|
||||||
Avg_Depth_of_cut_cm depth_of_cut_cm ,
|
|
||||||
Fuel_consumption_lit_hr::float fuel_consumption_lit_per_hr,
|
|
||||||
Area_covered_acr_hr::float area_covered_acr_per_hr,
|
|
||||||
Fuel_consumption_lit_Acr::float fuel_consumption_lit_per_acr,
|
|
||||||
case when fuel_consumption_lit_hr_2 ~ E''^\\d+$'' then fuel_consumption_lit_hr_2::int else null end as fuel_consumption_var_lit_per_hr,
|
|
||||||
case when area_covered_acr_hr_2 ~ E''^\\d+$'' then area_covered_acr_hr_2::int else null end as area_covered_var_acr_per_hr ,
|
|
||||||
case when fuel_consumption_lit_acr_2 ~ E''^\\d+$'' then fuel_consumption_lit_acr_2::int else null end as fuel_consumption_var_lit_per_acr,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance tractor_braking_perf,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response implement_lifting_per_lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.FTWET_SUM_Test_Condition_Block where engine_rpm_set <> ''0''';
|
|
||||||
|
|
||||||
end
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
|
|
||||||
select mmt_staging2.fn_FTWET_SUM_ODS ();
|
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
|
|
||||||
drop function if exists mmt_staging2.fn_FTWET_TRS_ODS ;
|
|
||||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTWET_TRS_ODS()
|
|
||||||
RETURNS void AS $$
|
|
||||||
begin
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_file_ref_no ,
|
|
||||||
test_report_no,
|
|
||||||
objective_of_test,
|
|
||||||
background_of_test,
|
|
||||||
job_order_no,
|
|
||||||
test_location_name,
|
|
||||||
soil_moisture_content_pct,
|
|
||||||
soil_bulk_density_g_per_cc,
|
|
||||||
test_engineer,
|
|
||||||
test_operator,
|
|
||||||
date_of_test,
|
|
||||||
test_report_date,
|
|
||||||
season,
|
|
||||||
type_of_soil,
|
|
||||||
soil_cone_index,
|
|
||||||
field_condition
|
|
||||||
)
|
|
||||||
select client_id,
|
|
||||||
function_id,
|
|
||||||
file_syspk,
|
|
||||||
report_reference_no test_report_no,
|
|
||||||
objective_of_test,
|
|
||||||
background_of_test,
|
|
||||||
job_order_no,
|
|
||||||
test_location test_location_name,
|
|
||||||
soil_moisture_content_::int soil_moisture_content_pct ,
|
|
||||||
soil_bulk_density_g_cc::int soil_bulk_density_g_per_cc,
|
|
||||||
test_engineer,
|
|
||||||
test_operator,
|
|
||||||
date_of_test::date,
|
|
||||||
report_date::date test_report_date,
|
|
||||||
season,
|
|
||||||
type_of_soil,
|
|
||||||
soil_cone_index_kpa::int soil_cone_index,
|
|
||||||
field_condition
|
|
||||||
from mmt_staging2.ftwet_trs_h1_block';
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_tractor_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_sr_no,
|
|
||||||
tractor_engine_hp,
|
|
||||||
fip_type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
wheel_drive_type,
|
|
||||||
egr_yn,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
tractor_weight_front_kg,
|
|
||||||
tractor_weight_rear_kg,
|
|
||||||
tractor_weight_total_kg,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
mechanical_ballast_rear_in_kg,
|
|
||||||
water_ballast_rear_75_pct ,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
mechanical_ballast_front_kg ,
|
|
||||||
Total_Ballast_Weight,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select client_id,
|
|
||||||
function_id,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP::float,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading::float,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD wheel_drive_type ,
|
|
||||||
EGR_Yes_No egr_yn,
|
|
||||||
Brake_Type ,
|
|
||||||
PTO_Type ,
|
|
||||||
Standard_PTO_Speed_RPM::int,
|
|
||||||
EPTO_Speed_RPM::int,
|
|
||||||
Tractor_Weight_kg_Front::int tractor_weight_front_kg ,
|
|
||||||
Tractor_Weight_kg_Rear::int tractor_weight_rear_kg ,
|
|
||||||
Tractor_Weight_kg_Total::int tractor_weight_total_kg ,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear_in_KG::int mechanical_ballast_rear_in_kg ,
|
|
||||||
Water_Ballast_Rear water_ballast_rear_75_pct ,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg::int mechanical_ballast_front_kg ,
|
|
||||||
Total_Ballast_Weight::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftwet_trs_spec_block where tractor_model is not null';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_engine_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
low_idle_declared,
|
|
||||||
high_idle_declared,
|
|
||||||
rated_rpm,
|
|
||||||
engine_to_pto_ratio_540_pto,
|
|
||||||
engine_to_pto_ratio_540e_pto,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
low_idle low_idle_declared,
|
|
||||||
high_idle high_idle_declared,
|
|
||||||
rated_rpm::int,
|
|
||||||
engine_to_pto_ratio_540_pto,
|
|
||||||
engine_to_pto_ratio_540e_pto,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftwet_trs_engine_rpm_block where tractor_model is not null';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_implement_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
name_of_implement,
|
|
||||||
type_of_implement,
|
|
||||||
make_of_implement,
|
|
||||||
no_of_disc_blades_bottoms,
|
|
||||||
cutting_width_m,
|
|
||||||
implement_weight_kg,
|
|
||||||
hitch_category,
|
|
||||||
span_for_mounted_implement_cm,
|
|
||||||
mast_height_for_mounted_implement_cm,
|
|
||||||
type_of_cage_wheel_hcw_fcw,
|
|
||||||
Cage_Wheel_Width_mm,
|
|
||||||
cage_wheel_weight_kg,
|
|
||||||
cage_wheel_inner_ring_dia_mm,
|
|
||||||
cage_wheel_outer_ring_dia_mm,
|
|
||||||
cage_wheel_center_ring_dia_mm,
|
|
||||||
dist_btwn_lhs_fcw_to_rhs_fcw_mm,
|
|
||||||
No_of_angles_on_cage_wheel,
|
|
||||||
No_of_days_of_water_logging,
|
|
||||||
Depth_of_water_mm,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,function_id,
|
|
||||||
name_of_implement,
|
|
||||||
type_of_implement,
|
|
||||||
make_of_implement,
|
|
||||||
no_of_bottoms_tyne_disc_blade::int no_of_disc_blades_bottoms,
|
|
||||||
cutting_width_m,
|
|
||||||
implement_weight_kg::int,
|
|
||||||
hitch_category,
|
|
||||||
span_cm_for_mounted_implement::int span_for_mounted_implement_cm ,
|
|
||||||
mast_height_cm_for_mounted_implement::int mast_height_for_mounted_implement_cm,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel type_of_cage_wheel_hcw_fcw ,
|
|
||||||
Cage_Wheel_Width_mm::int,
|
|
||||||
Cage_wheel_Weight::int cage_wheel_weight_kg,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_inner_ring_dia_mm ,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm::int cage_wheel_outer_ring_dia_mm,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm::int cage_wheel_center_ring_dia_mm ,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel::int dist_btwn_lhs_fcw_to_rhs_fcw_mm,
|
|
||||||
No_of_angles_on_cage_wheel::int,
|
|
||||||
No_of_days_of_water_logging::int,
|
|
||||||
Depth_of_water_mm::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftwet_trs_implement_block where name_of_implement is not null';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
select fn_FTWET_TRS_ODS();
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('BUDNI','BUDNI_DBP','BUDNI_DBP_Spec_H1','Test Tractor Specifiactions'),
|
|
||||||
('BUDNI','BUDNI_DBP','BUDNI_DBP_Drawbar_Perf','Tractor Drawbar Performance Report.');
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Spec_H1','Test Tractor Specifiactions'),
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Atmos_Cond','Atmospheric conditions:'),
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Meas_Results','Gear'),
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Atmos_Cond_2','Atmospheric conditions:_2'),
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Meas_Results','Gear_2'),
|
|
||||||
('BUDNI','BUDNI_NMT','BUDNI_NMT_Test_Observe','Noise Measurement Test Observations Summary');
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('BUDNI','BUDNI_LCG','BUDNI_LCG_Spec_H1','Test Tractor Specifiactions'),
|
|
||||||
('BUDNI','BUDNI_LCG','BUDNI_LCG_Wheel','Wheel Base'),
|
|
||||||
('BUDNI','BUDNI_LCG','BUDNI_LCG_Gravity_Test','Location of centre of Gravity Test');
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('BUDNI','BUDNI_PTO','BUDNI_PTO_Spec_H1','Test Tractor Specifiactions'),
|
|
||||||
('BUDNI','BUDNI_PTO','BUDNI_PTO_Report','PTO Performance Report'),
|
|
||||||
('BUDNI','BUDNI_PTO','BUDNI_PTO_MMTKeyword1','MMTKeyword1'),
|
|
||||||
('BUDNI','BUDNI_PTO','BUDNI_PTO_MMTKeyword2','MMTKeyword2'),
|
|
||||||
('BUDNI','BUDNI_PTO','BUDNI_PTO_Summary','PTO Performance Test Observations Summary');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,704 +0,0 @@
|
|||||||
create TABLE mmt_staging2.stg_process_table_budni_dbp (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 NULL,
|
|
||||||
create_time timestamp DEFAULT current_timestamp,
|
|
||||||
rank int4 NULL,
|
|
||||||
rank_tag text null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE mmt_staging2.stg_specific_table_budni_dbp (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 null,
|
|
||||||
create_time timestamp DEFAULT current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
create TABLE mmt_staging2.stg_process_table_budni_nmt (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 NULL,
|
|
||||||
create_time timestamp DEFAULT current_timestamp,
|
|
||||||
rank int4 NULL,
|
|
||||||
rank_tag text null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE mmt_staging2.stg_specific_table_budni_nmt (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 null,
|
|
||||||
create_time timestamp DEFAULT current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
create TABLE mmt_staging2.stg_process_table_BUDNI_LCG (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 NULL,
|
|
||||||
create_time timestamp DEFAULT current_timestamp,
|
|
||||||
rank int4 NULL,
|
|
||||||
rank_tag text null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE mmt_staging2.stg_specific_table_BUDNI_LCG (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 null,
|
|
||||||
create_time timestamp DEFAULT current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
create TABLE mmt_staging2.stg_process_table_BUDNI_PTO (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 NULL,
|
|
||||||
create_time timestamp DEFAULT current_timestamp,
|
|
||||||
rank int4 NULL,
|
|
||||||
rank_tag text null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE mmt_staging2.stg_specific_table_BUDNI_PTO (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 null,
|
|
||||||
create_time timestamp DEFAULT current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
create TABLE mmt_staging2.stg_process_table_BUDNI_HDL (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 NULL,
|
|
||||||
create_time timestamp DEFAULT current_timestamp,
|
|
||||||
rank int4 NULL,
|
|
||||||
rank_tag text null
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE mmt_staging2.stg_specific_table_BUDNI_HDL (
|
|
||||||
generic_syspk int,
|
|
||||||
file_syspk bigint,
|
|
||||||
file_name varchar(1024) NULL,
|
|
||||||
file_date date NULL,
|
|
||||||
file_format varchar(1024) NULL,
|
|
||||||
sheet_number int4 NULL,
|
|
||||||
sheet_name varchar(1024) NULL,
|
|
||||||
sheet_format text,
|
|
||||||
sheet_mnemonic varchar(1024) NULL,
|
|
||||||
row_number int4 NULL,
|
|
||||||
file_creation_date timestamp NULL,
|
|
||||||
column1 varchar(1024) NULL,
|
|
||||||
column2 varchar(1024) NULL,
|
|
||||||
column3 varchar(1024) NULL,
|
|
||||||
column4 varchar(1024) NULL,
|
|
||||||
column5 varchar(1024) NULL,
|
|
||||||
column6 varchar(1024) NULL,
|
|
||||||
column7 varchar(1024) NULL,
|
|
||||||
column8 varchar(1024) NULL,
|
|
||||||
column9 varchar(1024) NULL,
|
|
||||||
column10 varchar(1024) NULL,
|
|
||||||
column11 varchar(1024) NULL,
|
|
||||||
column12 varchar(1024) NULL,
|
|
||||||
column13 varchar(1024) NULL,
|
|
||||||
column14 varchar(1024) NULL,
|
|
||||||
column15 varchar(1024) NULL,
|
|
||||||
column16 varchar(1024) NULL,
|
|
||||||
column17 varchar(1024) NULL,
|
|
||||||
column18 varchar(1024) NULL,
|
|
||||||
column19 varchar(1024) NULL,
|
|
||||||
column20 varchar(1024) NULL,
|
|
||||||
column21 varchar(1024) NULL,
|
|
||||||
column22 varchar(1024) NULL,
|
|
||||||
column23 varchar(1024) NULL,
|
|
||||||
column24 varchar(1024) NULL,
|
|
||||||
column25 varchar(1024) NULL,
|
|
||||||
column26 varchar(1024) NULL,
|
|
||||||
column27 varchar(1024) NULL,
|
|
||||||
column28 varchar(1024) NULL,
|
|
||||||
column29 varchar(1024) NULL,
|
|
||||||
column30 varchar(1024) NULL,
|
|
||||||
column31 varchar(1024) NULL,
|
|
||||||
column32 varchar(1024) NULL,
|
|
||||||
column33 varchar(1024) NULL,
|
|
||||||
column34 varchar(1024) NULL,
|
|
||||||
column35 varchar(1024) NULL,
|
|
||||||
column36 varchar(1024) NULL,
|
|
||||||
column37 varchar(1024) NULL,
|
|
||||||
column38 varchar(1024) NULL,
|
|
||||||
column39 varchar(1024) NULL,
|
|
||||||
column40 varchar(1024) NULL,
|
|
||||||
column41 varchar(1024) NULL,
|
|
||||||
column42 varchar(1024) NULL,
|
|
||||||
column43 varchar(1024) NULL,
|
|
||||||
column44 varchar(1024) NULL,
|
|
||||||
column45 varchar(1024) NULL,
|
|
||||||
column46 varchar(1024) NULL,
|
|
||||||
column47 varchar(1024) NULL,
|
|
||||||
column48 varchar(1024) NULL,
|
|
||||||
column49 varchar(1024) NULL,
|
|
||||||
column50 varchar(1024) NULL,
|
|
||||||
column51 varchar(1024) NULL,
|
|
||||||
column52 varchar(1024) NULL,
|
|
||||||
column53 varchar(1024) NULL,
|
|
||||||
is_rownumber_fetched int4 null,
|
|
||||||
create_time timestamp DEFAULT current_timestamp
|
|
||||||
);
|
|
||||||
|
|
||||||
@@ -1,362 +0,0 @@
|
|||||||
|
|
||||||
insert into mmt_format_config (f1_modified) values
|
|
||||||
('Tractor Model'),
|
|
||||||
('Make of Implement '),
|
|
||||||
('Test Condition:_1'),
|
|
||||||
('Test Engineer Comments_1'),
|
|
||||||
('Test Manager Comments_1'),
|
|
||||||
('Test Condition:_2'),
|
|
||||||
('Test Engineer Comments_2'),
|
|
||||||
('Test Manager Comments_2');
|
|
||||||
|
|
||||||
select * from mmt_format_config;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=f1_modified where f1_source is null;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(trailing from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(leading from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set format='plough_field_summary' where format is null;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source = replace(f1_source,'_1','');
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_field_summary b
|
|
||||||
where f1_source=column1
|
|
||||||
and b.is_rownumber_fetched is NULL and b.src_table_name='plough')
|
|
||||||
where a.row_number_start is null and format='plough_field_summary';
|
|
||||||
|
|
||||||
update union_field_summary a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_format_config b
|
|
||||||
where F1_source=column1
|
|
||||||
and b.row_number_start=a.syspk
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source = replace(f1_source,'_2','');
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_field_summary b
|
|
||||||
where f1_source=column1
|
|
||||||
and b.is_rownumber_fetched is NULL and b.src_table_name='plough')
|
|
||||||
where a.row_number_start is null and format='plough_field_summary';
|
|
||||||
|
|
||||||
update union_field_summary a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_format_config b
|
|
||||||
where F1_source=column1
|
|
||||||
and b.row_number_start=a.syspk
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_format_config b
|
|
||||||
where b.syspk=a.syspk+1)
|
|
||||||
where a.format='plough_field_summary';
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
create table dry_field_summary_tractor_model_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
select * from dry_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_make_implement_2;
|
|
||||||
|
|
||||||
create table dry_field_summary_make_implement_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Make of Implement ' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
select * from dry_field_summary_make_implement_2;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_test_condition_1;
|
|
||||||
|
|
||||||
create table dry_field_summary_test_condition_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition:_1' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_engineer_comments_1 ;
|
|
||||||
|
|
||||||
create table dry_field_summary_engineer_comments_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_1' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_manager_comments_1 ;
|
|
||||||
|
|
||||||
create table dry_field_summary_manager_comments_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_1' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_test_condition_2;
|
|
||||||
|
|
||||||
create table dry_field_summary_test_condition_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition:_2' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_engineer_comments_2 ;
|
|
||||||
|
|
||||||
create table dry_field_summary_engineer_comments_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_2' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists dry_field_summary_manager_comments_2 ;
|
|
||||||
|
|
||||||
select * from dry_field_summary_manager_comments_2;
|
|
||||||
|
|
||||||
create table dry_field_summary_manager_comments_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_2' and a.src_table_name ='plough' and b.format ='plough_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
alter table dry_field_summary_test_condition_1 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_summary_test_condition_1 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_summary_test_condition_1 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
drop table transpose_dry_field_summary_test_condition_1;
|
|
||||||
|
|
||||||
create table transpose_dry_field_summary_test_condition_1
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight text,
|
|
||||||
Engine_RPM_Drop_on_turn text,
|
|
||||||
Depth_of_cut_cm text,
|
|
||||||
No_load_speed_kmph text,
|
|
||||||
On_load_speed_kmph text,
|
|
||||||
wheel_slippage_ text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_dry_field_summary_test_condition_1
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight,
|
|
||||||
Engine_RPM_Drop_on_turn,
|
|
||||||
Depth_of_cut_cm,
|
|
||||||
No_load_speed_kmph,
|
|
||||||
On_load_speed_kmph,
|
|
||||||
wheel_slippage_,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_summary_test_condition_1
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alter table dry_field_summary_test_condition_2 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_summary_test_condition_2 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_summary_test_condition_2 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
drop table transpose_dry_field_summary_test_condition_1;
|
|
||||||
|
|
||||||
create table transpose_dry_field_summary_test_condition_2
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight text,
|
|
||||||
Engine_RPM_Drop_on_turn text,
|
|
||||||
Depth_of_cut_cm text,
|
|
||||||
No_load_speed_kmph text,
|
|
||||||
On_load_speed_kmph text,
|
|
||||||
wheel_slippage_ text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_dry_field_summary_test_condition_2
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight,
|
|
||||||
Engine_RPM_Drop_on_turn,
|
|
||||||
Depth_of_cut_cm,
|
|
||||||
No_load_speed_kmph,
|
|
||||||
On_load_speed_kmph,
|
|
||||||
wheel_slippage_,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_summary_test_condition_2
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,548 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Implement','Make of Implement'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_1','Test Condition_1:'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_1','Test Engineer Comments_1'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_1','Test Manager Comments_1'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_2','Test Condition_2:'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_2','Test Engineer Comments_2'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_2','Test Manager Comments_2')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTDRY' and sheet_format ='FTDRY_SUM'
|
|
||||||
and file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_1','')
|
|
||||||
where file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTDRY' and
|
|
||||||
b.sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_2','')
|
|
||||||
where file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTDRY' and
|
|
||||||
b.sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTDRY' and a.sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTDRY' and sheet_format='FTDRY_SUM';*/
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTDRY' and sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Trac_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Implement'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Make of Implement' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Test_Condition_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_1:' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Engineer_Comments_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_1' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Manager_Comments_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_1' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Test_Condition_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_2:' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Engineer_Comments_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_2' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_SUM_Manager_Comments_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_2' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTDRY_SUM_Test_Condition_1_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight text,
|
|
||||||
Engine_RPM_Drop_on_turn text,
|
|
||||||
Depth_of_cut_cm text,
|
|
||||||
No_load_speed_kmph text,
|
|
||||||
On_load_speed_kmph text,
|
|
||||||
wheel_slippage_ text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight,
|
|
||||||
Engine_RPM_Drop_on_turn,
|
|
||||||
Depth_of_cut_cm,
|
|
||||||
No_load_speed_kmph,
|
|
||||||
On_load_speed_kmph,
|
|
||||||
wheel_slippage_,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Test_Condition_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight text,
|
|
||||||
Engine_RPM_Drop_on_turn text,
|
|
||||||
Depth_of_cut_cm text,
|
|
||||||
No_load_speed_kmph text,
|
|
||||||
On_load_speed_kmph text,
|
|
||||||
wheel_slippage_ text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight,
|
|
||||||
Engine_RPM_Drop_on_turn,
|
|
||||||
Depth_of_cut_cm,
|
|
||||||
No_load_speed_kmph,
|
|
||||||
On_load_speed_kmph,
|
|
||||||
wheel_slippage_,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Test_Condition_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text);
|
|
||||||
;
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_1_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Test_Condition_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Test_Condition_2_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Engineer_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Engineer_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Engineer_Comments_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_1_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Manager_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Manager_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Manager_Comments_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_1_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Engineer_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Engineer_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Engineer_Comments_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Engineer_Comments_2_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Manager_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Manager_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_SUM_Manager_Comments_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_SUM_Manager_Comments_2_Block
|
|
||||||
set sheet_format='FTDRY_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_name,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','summary','FTDRY_summary_Tractor Model','Tractor Model'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Make of Implement','Make of Implement'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Condition_1:','Test Condition_1:'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Engineer Comments_1','Test Engineer Comments_1'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Manager Comments_1','Test Manager Comments_1'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Condition:_2','Test Condition:_2'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Engineer Comments_2','Test Engineer Comments_2'),
|
|
||||||
('FTDRY','summary','FTDRY_summary_Test Manager Comments_2','Test Manager Comments_2')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
create table mmt_staging2.process_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTDRY' and sheet_name='Summary Sheet Field Perf.'
|
|
||||||
and file_name
|
|
||||||
='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,408 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_name,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','tractor_specifications','FTDRY_tractor_specifications_Tractor Specifications Sheet','Tractor Specifications Sheet'),
|
|
||||||
('FTDRY','tractor_specifications','FTDRY_tractor_specifications_Tractor Specifications','Tractor Specifications'),
|
|
||||||
('FTDRY','tractor_specifications','FTDRY_tractor_specifications_Engine RPM Data:','Engine RPM Data:'),
|
|
||||||
('FTDRY','tractor_specifications','FTDRY_tractor_specifications_Implement Details','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
create table mmt_staging2.process_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTDRY' and sheet_name='Tractor specifications'
|
|
||||||
and file_name
|
|
||||||
='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.process_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
select * from mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified);
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified);
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where f1_source is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source);
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source);
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.process_table_deepthi b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTDRY';
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTDRY';
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5,column7 c6
|
|
||||||
from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and b.file_format ='FTDRY'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTDRY'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTDRY'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTDRY_tractor_specifications_Implement_Details;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Implement_Details
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and a.column2 <> ''
|
|
||||||
and b.f1_modified='Implement Details' and b.file_format ='FTDRY'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Implement_Details;
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Season');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet(c1)
|
|
||||||
values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet(c1)
|
|
||||||
values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Field Condition');
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c4 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c3)
|
|
||||||
and b.c3='Date of Test')
|
|
||||||
where a.c1='Date of Test' ;
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c6 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c5)
|
|
||||||
and b.c5='Report Date')
|
|
||||||
where a.c1='Report Date';
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Season')
|
|
||||||
where a.c1='Season';
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Type of Soil')
|
|
||||||
where a.c1='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Soil Cone Index (kPa)')
|
|
||||||
where a.c1='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Field Condition')
|
|
||||||
where a.c1='Field Condition';
|
|
||||||
|
|
||||||
CREATE EXTENSION tablefunc;
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5,c6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text,c6::text]) AS val
|
|
||||||
FROM mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications drop column if exists a_c ;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Rear_in_KG text,
|
|
||||||
Water_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Mechanical_Ballast_Front_in_Kg text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi ,
|
|
||||||
Tractor_Weight_kg_Front ,
|
|
||||||
Tractor_Weight_kg_Rear ,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Rear_in_KG ,
|
|
||||||
Water_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTDRY_tractor_specifications_Engine_RPM_Data
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table ftdry_tractor_specifications_implement_details add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
alter table ftdry_tractor_specifications_implement_details add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update ftdry_tractor_specifications_implement_details set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
|
|
||||||
drop table ftdry_tractor_specifications_implement_details_tr
|
|
||||||
|
|
||||||
create table ftdry_tractor_specifications_implement_details_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into ftdry_tractor_specifications_implement_details_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Hitch_Category,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text]) AS val
|
|
||||||
FROM ftdry_tractor_specifications_implement_details
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text);
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,461 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_H1','Tractor Specifications Sheet'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_Implement','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTDRY' and sheet_format ='FTDRY_TRS'
|
|
||||||
and file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
insert into
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTDRY' and sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTDRY' and
|
|
||||||
b.sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTDRY' and
|
|
||||||
sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTDRY' and a.sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTDRY' and sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTDRY' and sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_TRS_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_TRS_SPEC'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_TRS_Engine_RPM'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTDRY_TRS_Implement'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and a.column2 <> ''
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Implement Details' and b.file_format ='FTDRY' and b.sheet_format='FTDRY_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_TRS_H1_INT as select * from mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
where rank_tag='FTDRY_TRS_H1';
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT(column2) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT(column2) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT(column2) values ('Season');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT (column2) values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT (column2) values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_INT (column2) values ('Field Condition');
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column5 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Date of Test')
|
|
||||||
where a.column2='Date of Test';
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column7 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column6)
|
|
||||||
and b.column6='Report Date')
|
|
||||||
where a.column2='Report Date';
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Season')
|
|
||||||
where a.column2='Season';
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Type of Soil')
|
|
||||||
where a.column2='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Soil Cone Index (kPa)')
|
|
||||||
where a.column2='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTDRY_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Field Condition')
|
|
||||||
where a.column2='Field Condition';
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_H1_INT add column a_c text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_INT set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
select * from mmt_staging2.FTDRY_TRS_H1_INT
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTDRY_TRS_H1_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text]) AS val
|
|
||||||
FROM mmt_staging2.FTDRY_TRS_H1_INT'
|
|
||||||
-- ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_H1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx'
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_H1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_H1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_H1_Block
|
|
||||||
set sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table mmt_staging2.FTDRY_TRS_SPEC_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Rear_in_KG text,
|
|
||||||
Water_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Mechanical_Ballast_Front_in_Kg text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi ,
|
|
||||||
Tractor_Weight_kg_Front ,
|
|
||||||
Tractor_Weight_kg_Rear ,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Rear_in_KG ,
|
|
||||||
Water_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_TRS_SPEC''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_SPEC_Block add column file_name text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_SPEC_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx'
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_SPEC_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_SPEC_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_SPEC_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_SPEC_Block
|
|
||||||
set sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column1::text,column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_TRS_Engine_RPM''
|
|
||||||
ORDER BY generate_series(1,6),1'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Engine_RPM_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Engine_RPM_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx'
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Engine_RPM_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Engine_RPM_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Engine_RPM_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Engine_RPM_Block
|
|
||||||
set sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTDRY_TRS_Implement_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTDRY_TRS_Implement_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Hitch_Category,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTDRY_TRS_Implement''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text);
|
|
||||||
;
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Implement_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Implement_Block
|
|
||||||
set file_name='20210217_FTDRY_1. FC - Arjun 555 HBTU Plough_dry land L3 @ 1500 with Arjun 605 Sindhnoor.xlsx'
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Implement_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Implement_Block
|
|
||||||
set file_format='FTDRY';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTDRY_TRS_Implement_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTDRY_TRS_Implement_Block
|
|
||||||
set sheet_format='FTDRY_TRS';
|
|
||||||
|
|
||||||
/*drop table mmt_staging2.ftdry_trs_h1_int ;
|
|
||||||
|
|
||||||
drop table mmt_staging2.ftdry_trs_h1_block ;
|
|
||||||
|
|
||||||
drop table mmt_staging2.ftdry_trs_implement_block ;
|
|
||||||
|
|
||||||
drop table mmt_staging2.ftdry_trs_spec_block;
|
|
||||||
|
|
||||||
drop table mmt_staging2.ftdry_trs_engine_rpm_block;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi ;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_number_start = null , row_previous_number = null, row_read_end = null , run_date =null , run_time =null where file_format='FTDRY'
|
|
||||||
and sheet_format ='FTDRY_TRS';*/
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
drop function if exists mmt_staging2.fn_FTDRY_TRS_ODS ;
|
|
||||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_FTDRY_TRS_ODS()
|
|
||||||
RETURNS void AS $$
|
|
||||||
begin
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
test_file_ref_no ,
|
|
||||||
test_report_no,
|
|
||||||
objective_of_test,
|
|
||||||
background_of_test,
|
|
||||||
job_order_no,
|
|
||||||
test_location_name,
|
|
||||||
soil_moisture_content_pct,
|
|
||||||
soil_bulk_density_g_per_cc,
|
|
||||||
test_engineer,
|
|
||||||
test_operator,
|
|
||||||
date_of_test,
|
|
||||||
test_report_date,
|
|
||||||
season,
|
|
||||||
type_of_soil,
|
|
||||||
soil_cone_index,
|
|
||||||
field_condition
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
file_syspk,
|
|
||||||
report_reference_no test_report_no,
|
|
||||||
objective_of_test,
|
|
||||||
background_of_test,
|
|
||||||
job_order_no,
|
|
||||||
test_location test_location_name,
|
|
||||||
soil_moisture_content_::int soil_moisture_content_pct ,
|
|
||||||
soil_bulk_density_g_cc::int soil_bulk_density_g_per_cc,
|
|
||||||
test_engineer,
|
|
||||||
test_operator,
|
|
||||||
date_of_test::date,
|
|
||||||
report_date::date test_report_date,
|
|
||||||
season,
|
|
||||||
type_of_soil,
|
|
||||||
soil_cone_index_kpa::int soil_cone_index,
|
|
||||||
field_condition
|
|
||||||
from mmt_staging2.ftdry_trs_h1_block';
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_tractor_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
tractor_sr_no,
|
|
||||||
tractor_engine_hp,
|
|
||||||
fip_type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
wheel_drive_type,
|
|
||||||
egr_yn,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
tractor_weight_front_kg,
|
|
||||||
tractor_weight_rear_kg,
|
|
||||||
tractor_weight_total_kg,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
mechanical_ballast_rear_in_kg,
|
|
||||||
water_ballast_rear_75_pct ,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
mechanical_ballast_front_kg ,
|
|
||||||
Total_Ballast_Weight,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP::float,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading::int,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD wheel_drive_type ,
|
|
||||||
EGR_Yes_No egr_yn,
|
|
||||||
Brake_Type ,
|
|
||||||
PTO_Type ,
|
|
||||||
Standard_PTO_Speed_RPM::int,
|
|
||||||
EPTO_Speed_RPM::int,
|
|
||||||
Tractor_Weight_kg_Front::int tractor_weight_front_kg ,
|
|
||||||
Tractor_Weight_kg_Rear::int tractor_weight_rear_kg ,
|
|
||||||
Tractor_Weight_kg_Total::int tractor_weight_total_kg ,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Rear_in_KG::int mechanical_ballast_rear_in_kg ,
|
|
||||||
Water_Ballast_Rear water_ballast_rear_75_pct ,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg::int mechanical_ballast_front_kg ,
|
|
||||||
Total_Ballast_Weight::int,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_trs_spec_block' ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_engine_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
low_idle_observed ,
|
|
||||||
high_idle_observed ,
|
|
||||||
rated_rpm,
|
|
||||||
engine_to_pto_ratio_540_pto,
|
|
||||||
engine_to_pto_ratio_540e_pto,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
low_idle::int low_idle_observed ,
|
|
||||||
high_idle::int high_idle_observed ,
|
|
||||||
rated_rpm::int,
|
|
||||||
engine_to_pto_ratio_540_pto,
|
|
||||||
engine_to_pto_ratio_540e_pto,
|
|
||||||
tractor_model,
|
|
||||||
tractor_make,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_trs_engine_rpm_block
|
|
||||||
where tractor_model is not null';
|
|
||||||
|
|
||||||
execute 'insert into mmt_ods.test_instance_implement_info
|
|
||||||
(
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
name_of_implement,
|
|
||||||
type_of_implement,
|
|
||||||
make_of_implement,
|
|
||||||
no_of_disc_blades_bottoms,
|
|
||||||
cutting_width_m,
|
|
||||||
implement_weight_kg,
|
|
||||||
hitch_category,
|
|
||||||
span_for_mounted_implement_cm,
|
|
||||||
mast_height_for_mounted_implement_cm,
|
|
||||||
test_file_ref_no
|
|
||||||
)
|
|
||||||
select
|
|
||||||
client_id,
|
|
||||||
function_id,
|
|
||||||
name_of_implement,
|
|
||||||
type_of_implement,
|
|
||||||
make_of_implement,
|
|
||||||
no_of_bottoms_tyne_disc_blade::int no_of_disc_blades_bottoms,
|
|
||||||
cutting_width_m,
|
|
||||||
implement_weight_kg::int,
|
|
||||||
hitch_category,
|
|
||||||
span_cm_for_mounted_implement::int span_for_mounted_implement_cm ,
|
|
||||||
mast_height_cm_for_mounted_implement::int mast_height_for_mounted_implement_cm,
|
|
||||||
file_syspk
|
|
||||||
from mmt_staging2.ftdry_trs_implement_block where name_of_implement is not null';
|
|
||||||
|
|
||||||
end
|
|
||||||
$$ LANGUAGE plpgsql;
|
|
||||||
|
|
||||||
select mmt_staging2.fn_FTDRY_TRS_ODS();
|
|
||||||
@@ -1,536 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Trail_Type','Trailer Type'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Test_Condition_1','Test Condition_1:'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Engineer_Comments_1','Test Engineer Comments_1'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Manager_Comments_1','Test Manager Comments_1'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Test_Condition_2','Test Condition_2:'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Engineer_Comments_2','Test Engineer Comments_2'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Manager_Comments_2','Test Manager Comments_2')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTHLG' and sheet_format ='FTHLG_SUM'
|
|
||||||
and file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_1','')
|
|
||||||
where file_format='FTHLG' and sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTHLG' and sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTHLG' and
|
|
||||||
b.sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set f1_source = replace(f1_source,'_2','')
|
|
||||||
where file_format='FTHLG' and sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTHLG' and sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTHLG' and
|
|
||||||
b.sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTHLG' and a.sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTHLG' and sheet_format='FTHLG_SUM';*/
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTHLG' and sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Trac_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Trail_Type'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Trailer Type' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Test_Condition_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_1:' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Engineer_Comments_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_1' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Manager_Comments_1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_1' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Test_Condition_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_2:' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Engineer_Comments_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_2' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_SUM_Manager_Comments_2'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_2' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTHLG_SUM_Test_Condition_1_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Fuel_consumption_Ltr_hr text,
|
|
||||||
Mileage_Km_Ltr text,
|
|
||||||
Average_speed_of_travel_kmph text,
|
|
||||||
Total_distance_travelled_km text,
|
|
||||||
Gear_used_on_Straight_Road text,
|
|
||||||
Straight_road_RPM_Drop text,
|
|
||||||
Gear_used_on_Up_Slope_1 text,
|
|
||||||
Up_Slope_RPM_Drop_1 text,
|
|
||||||
Gear_used_on_Up_Slope_2 text,
|
|
||||||
Up_Slope_RPM_Drop_2 text,
|
|
||||||
Gear_used_on_Down_Slope text,
|
|
||||||
Down_Slope_RPM_Shoot_up text,
|
|
||||||
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Mileage_Km_Ltr_2 text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_3 text,
|
|
||||||
Mileage_Km_Ltr_3 text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Range_Gear_Shifting text,
|
|
||||||
Speed_Gear_Shifting text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr,
|
|
||||||
Mileage_Km_Ltr,
|
|
||||||
Average_speed_of_travel_kmph,
|
|
||||||
Total_distance_travelled_km,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Mileage_Km_Ltr_2,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors ,
|
|
||||||
Fuel_consumption_lit_hr_3,
|
|
||||||
Mileage_Km_Ltr_3,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Test_Condition_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Test_Condition_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Fuel_consumption_Ltr_hr text,
|
|
||||||
Mileage_Km_Ltr text,
|
|
||||||
Average_speed_of_travel_kmph text,
|
|
||||||
Total_distance_travelled_km text,
|
|
||||||
Gear_used_on_Straight_Road text,
|
|
||||||
Straight_road_RPM_Drop text,
|
|
||||||
Gear_used_on_Up_Slope_1 text,
|
|
||||||
Up_Slope_RPM_Drop_1 text,
|
|
||||||
Gear_used_on_Up_Slope_2 text,
|
|
||||||
Up_Slope_RPM_Drop_2 text,
|
|
||||||
Gear_used_on_Down_Slope text,
|
|
||||||
Down_Slope_RPM_Shoot_up text,
|
|
||||||
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Mileage_Km_Ltr_2 text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_3 text,
|
|
||||||
Mileage_Km_Ltr_3 text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Range_Gear_Shifting text,
|
|
||||||
Speed_Gear_Shifting text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Test_Condition_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr,
|
|
||||||
Mileage_Km_Ltr,
|
|
||||||
Average_speed_of_travel_kmph,
|
|
||||||
Total_distance_travelled_km,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
M_M_Performance_compared_to_respective_competitor_tractors_is_better_and_is_poor_than_competitor,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Mileage_Km_Ltr_2,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_3,
|
|
||||||
Mileage_Km_Ltr_3,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Test_Condition_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,a_31 text,a_32 text,a_33 text);
|
|
||||||
;
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_2_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_1_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Test_Condition_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Test_Condition_2_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Engineer_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Engineer_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Engineer_Comments_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_1_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Manager_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Manager_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Manager_Comments_1''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_1_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Engineer_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Engineer_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Engineer_Comments_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Engineer_Comments_2_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Manager_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Manager_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_SUM_Manager_Comments_2''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_SUM_Manager_Comments_2_Block
|
|
||||||
set sheet_format='FTHLG_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,410 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_name,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTHLG','Tractor Specifications','FTWET_tractor_specifications_Tractor Specifications Sheet','Tractor Specifications Sheet'),
|
|
||||||
('FTHLG','Tractor Specifications','FTWET_tractor_specifications_Tractor Specifications','Tractor Specifications'),
|
|
||||||
('FTHLG','Tractor Specifications','FTWET_tractor_specifications_Engine RPM Data:','Engine RPM Data:'),
|
|
||||||
('FTHLG','Tractor Specifications','FTWET_tractor_specifications_Trailer Details','Trailer Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.process_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTHLG' and sheet_name='Tractor specifications'
|
|
||||||
and file_name
|
|
||||||
='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.process_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi set is_rownumber_fetched = null;
|
|
||||||
|
|
||||||
|
|
||||||
select * from mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified);
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified);
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where F1_source is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source);
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source);
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.process_table_deepthi b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTHLG';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTHLG';
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5,column7 c6
|
|
||||||
from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor specifications sheet' and b.file_format ='FTHLG'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTHLG'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTHLG'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTHLG_tractor_specifications_Trailer_Details;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Trailer_Details
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and a.column2 <> ''
|
|
||||||
and b.f1_modified='Trailer Details' and b.file_format ='FTHLG'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet(c1) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet(c1) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet(c1) values ('Type of Road');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet(c1) values ('Tractor Hitch Height from Ground, mm');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet(c1) values ('Tractor Rear Wheel Center to Hitch Point Center Distance, mm');
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c4 from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c3)
|
|
||||||
and b.c3='Date of Test')
|
|
||||||
where a.c1='Date of Test' ;
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c6 from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c5)
|
|
||||||
and b.c5='Report Date')
|
|
||||||
where a.c1='Report Date';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Type of Road')
|
|
||||||
where a.c1='Type of Road';
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Tractor Hitch Height from Ground, mm')
|
|
||||||
where a.c1='Tractor Hitch Height from Ground, mm';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Tractor Rear Wheel Center to Hitch Point Center Distance, mm')
|
|
||||||
where a.c1='Tractor Rear Wheel Center to Hitch Point Center Distance, mm';
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Gradient_Slope_1_Degree text,
|
|
||||||
Gradient_Slope_2_Degree text,
|
|
||||||
Tractor_Hitch_Type text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Type_of_Road text,
|
|
||||||
Tractor_Hitch_Height_from_Ground_mm text,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Gradient_Slope_1_Degree,
|
|
||||||
Gradient_Slope_2_Degree,
|
|
||||||
Tractor_Hitch_Type,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Type_of_Road,
|
|
||||||
Tractor_Hitch_Height_from_Ground_mm,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5,c6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text,c6::text]) AS val
|
|
||||||
FROM mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
Hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear text,
|
|
||||||
Water_Ballast_Rear_75 text,
|
|
||||||
Front_bumper_weight_Kg text,
|
|
||||||
Mechanical_Ballast_Front_in_kg text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
Hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi,
|
|
||||||
Tractor_Weight_kg_Front,
|
|
||||||
Tractor_Weight_kg_Rear,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Water_Ballast_Rear_75,
|
|
||||||
Front_bumper_weight_Kg ,
|
|
||||||
Mechanical_Ballast_Front_in_kg,
|
|
||||||
Mechanical_Ballast_Front ,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTHLG_tractor_specifications_Tractor_Specifications
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTHLG_tractor_specifications_Engine_RPM_Data
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.fthlg_tractor_specifications_trailer_details add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.fthlg_tractor_specifications_trailer_details add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.fthlg_tractor_specifications_trailer_details set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.fthlg_tractor_specifications_trailer_details_tr;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging1.fthlg_tractor_specifications_trailer_details_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Type_Of_Trailer text,
|
|
||||||
No_Of_Axle text,
|
|
||||||
No_Of_Wheels text,
|
|
||||||
Trailer_hitch_Height_above_ground_level_mm text,
|
|
||||||
Make_model_of_trailer text,
|
|
||||||
Trailer_platform_length_mm text,
|
|
||||||
Trailer_platform_Width_mm text,
|
|
||||||
Trailer_platform_Height_mm text,
|
|
||||||
Tire_size text,
|
|
||||||
Inflation_pressure_psi text,
|
|
||||||
Track_width_of_trailer_mm text,
|
|
||||||
Horizontal_distance_of_hitch_point_from_trailer_front_face_mm text,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm text,
|
|
||||||
Distance_from_Trailerfront_axle_distance_from_hitch_point_mm text,
|
|
||||||
Distance_from_tractor_rear_wheel_center_to_tractor_rear_wheel_center_mm text,
|
|
||||||
Trailer_empty_weight_Kg text,
|
|
||||||
Trailer_Gross_Weight_Kg text,
|
|
||||||
FDPD_TDC_Mar15_009 text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.fthlg_tractor_specifications_trailer_details_tr
|
|
||||||
(
|
|
||||||
Type_Of_Trailer,
|
|
||||||
No_Of_Axle,
|
|
||||||
No_Of_Wheels,
|
|
||||||
Trailer_hitch_Height_above_ground_level_mm,
|
|
||||||
Make_model_of_trailer,
|
|
||||||
Trailer_platform_length_mm,
|
|
||||||
Trailer_platform_Width_mm,
|
|
||||||
Trailer_platform_Height_mm,
|
|
||||||
Tire_size,
|
|
||||||
Inflation_pressure_psi,
|
|
||||||
Track_width_of_trailer_mm,
|
|
||||||
Horizontal_distance_of_hitch_point_from_trailer_front_face_mm,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm,
|
|
||||||
Distance_from_Trailerfront_axle_distance_from_hitch_point_mm,
|
|
||||||
Distance_from_tractor_rear_wheel_center_to_tractor_rear_wheel_center_mm,
|
|
||||||
Trailer_empty_weight_Kg,
|
|
||||||
Trailer_Gross_Weight_Kg,
|
|
||||||
FDPD_TDC_Mar15_009
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text]) AS val
|
|
||||||
FROM mmt_staging1.fthlg_tractor_specifications_trailer_details
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text);
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,455 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_H1','Tractor specifications sheet'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_Trailer','Trailer Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTHLG' and sheet_format ='FTHLG_TRS'
|
|
||||||
and file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTHLG' and sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTHLG' and
|
|
||||||
b.sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTHLG' and
|
|
||||||
sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTHLG' and a.sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTHLG' and sheet_format='FTHLG_TRS';*/
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTHLG' and sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_TRS_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor specifications sheet' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_TRS_SPEC'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_TRS_Engine_RPM'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTHLG_TRS_Trailer'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Trailer Details' and b.file_format ='FTHLG' and b.sheet_format='FTHLG_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
delete from mmt_staging2.mmt_staging_process_table_deepthi where row_number between 88 and 98;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_TRS_H1_INT as select * from mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
where rank_tag='FTHLG_TRS_H1';
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_INT(column2) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_INT(column2) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_INT(column2) values ('Type of Road');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_INT (column2) values ('Tractor Hitch Height from Ground, mm');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_INT (column2) values ('Tractor Rear Wheel Center to Hitch Point Center Distance, mm');
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT a
|
|
||||||
set column3=(select column5 from mmt_staging2.FTHLG_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Date of Test')
|
|
||||||
where a.column2='Date of Test';
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT a
|
|
||||||
set column3=(select column7 from mmt_staging2.FTHLG_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column6)
|
|
||||||
and b.column6='Report Date')
|
|
||||||
where a.column2='Report Date';
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTHLG_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Type of Road')
|
|
||||||
where a.column2='Type of Road';
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTHLG_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Tractor Hitch Height from Ground, mm')
|
|
||||||
where a.column2='Tractor Hitch Height from Ground, mm';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTHLG_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Tractor Rear Wheel Center to Hitch Point Center Distance, mm')
|
|
||||||
where a.column2='Tractor Rear Wheel Center to Hitch Point Center Distance, mm';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_H1_INT add column a_c text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_INT set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTHLG_TRS_H1_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Gradient_Slope_1_Degree text,
|
|
||||||
Gradient_Slope_2_Degree text,
|
|
||||||
Tractor_Hitch_Type text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Type_of_Road text,
|
|
||||||
Tractor_Hitch_Height_from_Ground_mm text,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Gradient_Slope_1_Degree,
|
|
||||||
Gradient_Slope_2_Degree,
|
|
||||||
Tractor_Hitch_Type,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Type_of_Road,
|
|
||||||
Tractor_Hitch_Height_from_Ground_mm,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text]) AS val
|
|
||||||
FROM mmt_staging2.FTHLG_TRS_H1_INT'
|
|
||||||
-- ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_H1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xslx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_H1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_H1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_H1_Block
|
|
||||||
set sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table mmt_staging2.FTHLG_TRS_SPEC_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
Hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear text,
|
|
||||||
Water_Ballast_Rear_75 text,
|
|
||||||
Front_bumper_weight_Kg text,
|
|
||||||
Mechanical_Ballast_Front_in_kg text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
Hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi,
|
|
||||||
Tractor_Weight_kg_Front,
|
|
||||||
Tractor_Weight_kg_Rear,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Water_Ballast_Rear_75,
|
|
||||||
Front_bumper_weight_Kg ,
|
|
||||||
Mechanical_Ballast_Front_in_kg,
|
|
||||||
Mechanical_Ballast_Front ,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_TRS_SPEC''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_SPEC_Block add column file_name text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_SPEC_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_SPEC_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_SPEC_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_SPEC_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_SPEC_Block
|
|
||||||
set sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column1::text,column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_TRS_Engine_RPM''
|
|
||||||
ORDER BY generate_series(1,6),1'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Engine_RPM_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Engine_RPM_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Engine_RPM_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Engine_RPM_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Engine_RPM_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Engine_RPM_Block
|
|
||||||
set sheet_format='FTHLG_TRS';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTHLG_TRS_Trailer_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Type_Of_Trailer text,
|
|
||||||
No_Of_Axle text,
|
|
||||||
No_Of_Wheels text,
|
|
||||||
Trailer_hitch_Height_above_ground_level_mm text,
|
|
||||||
Make_model_of_trailer text,
|
|
||||||
Trailer_platform_length_mm text,
|
|
||||||
Trailer_platform_Width_mm text,
|
|
||||||
Trailer_platform_Height_mm text,
|
|
||||||
Tire_size text,
|
|
||||||
Inflation_pressure_psi text,
|
|
||||||
Track_width_of_trailer_mm text,
|
|
||||||
Horizontal_distance_of_hitch_point_from_trailer_front_face_mm text,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm text,
|
|
||||||
Distance_from_Trailerfront_axle_distance_from_hitch_point_mm text,
|
|
||||||
Distance_from_tractor_rear_wheel_center_to_tractor_rear_wheel_center_mm text,
|
|
||||||
Trailer_empty_weight_Kg text,
|
|
||||||
Trailer_Gross_Weight_Kg text,
|
|
||||||
FDPD_TDC_Mar15_009 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTHLG_TRS_Trailer_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Type_Of_Trailer,
|
|
||||||
No_Of_Axle,
|
|
||||||
No_Of_Wheels,
|
|
||||||
Trailer_hitch_Height_above_ground_level_mm,
|
|
||||||
Make_model_of_trailer,
|
|
||||||
Trailer_platform_length_mm,
|
|
||||||
Trailer_platform_Width_mm,
|
|
||||||
Trailer_platform_Height_mm,
|
|
||||||
Tire_size,
|
|
||||||
Inflation_pressure_psi,
|
|
||||||
Track_width_of_trailer_mm,
|
|
||||||
Horizontal_distance_of_hitch_point_from_trailer_front_face_mm,
|
|
||||||
Tractor_Rear_Wheel_Center_to_Hitch_Point_Center_Distance_mm,
|
|
||||||
Distance_from_Trailerfront_axle_distance_from_hitch_point_mm,
|
|
||||||
Distance_from_tractor_rear_wheel_center_to_tractor_rear_wheel_center_mm,
|
|
||||||
Trailer_empty_weight_Kg,
|
|
||||||
Trailer_Gross_Weight_Kg,
|
|
||||||
FDPD_TDC_Mar15_009
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTHLG_TRS_Trailer''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text);
|
|
||||||
;
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Trailer_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Trailer_Block
|
|
||||||
set file_name='20210217_FTHLG_5. FC_M Star Trem IV Aternate Aapproch_57 HP_HAULAGE_BS3A_SINDHNOOR.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Trailer_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Trailer_Block
|
|
||||||
set file_format='FTHLG';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTHLG_TRS_Trailer_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTHLG_TRS_Trailer_Block
|
|
||||||
set sheet_format='FTHLG_TRS';
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Impement','Make of Implement'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Cage_Wheel','Type of Cage Wheel'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Test_Condition','Test Condition:'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Manager_Comment','Test Manager Comments')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTWET' and sheet_format ='FTWET_SUM'
|
|
||||||
and file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTWET' and sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTWET' and
|
|
||||||
b.sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTWET' and a.sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTWET' and sheet_format='FTWET_SUM';*/
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTWET' and sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_SUM_Trac_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and b.file_format ='FTWET' and b.sheet_format='FTWET_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_SUM_Impement'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Make of Implement' and b.file_format ='FTWET' and b.sheet_format='FTWET_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_SUM_Cage_Wheel'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Type of Cage Wheel' and b.file_format ='FTWET' and b.sheet_format='FTWET_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_SUM_Test_Condition'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition:' and b.file_format ='FTWET' and b.sheet_format='FTWET_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_SUM_Manager_Comments'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >=row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments' and b.file_format ='FTWET' and b.sheet_format='FTWET_SUM'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTWET_SUM_Test_Condition_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_SUM_Test_Condition_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass text,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass text,
|
|
||||||
No_of_passes text,
|
|
||||||
Avg_Depth_of_cut_cm text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_SUM_Test_Condition_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass,
|
|
||||||
No_of_passes,
|
|
||||||
Avg_Depth_of_cut_cm,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
M_M_Performance_in_compared_to_respective_competitor_tractors,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTWET_SUM_Test_Condition''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (ccol text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text,a_37 text,a_38 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Test_Condition_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Test_Condition_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Test_Condition_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Test_Condition_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Test_Condition_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Test_Condition_Block
|
|
||||||
set sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_SUM_Manager_Comments_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Manager_Comments text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_SUM_Manager_Comments_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Manager_Comments
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7,column8,column9,column10,column11,column12}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,column9::text,column10::text,column11::text,column12::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTWET_SUM_Manager_Comments''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Manager_Comments_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Manager_Comments_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Manager_Comments_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Manager_Comments_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_SUM_Manager_Comments_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_SUM_Manager_Comments_Block
|
|
||||||
set sheet_format='FTWET_SUM';
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,438 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_name,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTWET','Tractor Specifications','FTWET_tractor_specifications_Tractor Specifications Sheet','Tractor Specifications Sheet'),
|
|
||||||
('FTWET','Tractor Specifications','FTWET_tractor_specifications_Tractor Specifications','Tractor Specifications'),
|
|
||||||
('FTWET','Tractor Specifications','FTWET_tractor_specifications_Engine RPM Data:','Engine RPM Data:'),
|
|
||||||
('FTWET','Tractor Specifications','FTWET_tractor_specifications_Implement Details','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.process_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTWET' and sheet_name='Tractor specifications'
|
|
||||||
and file_name
|
|
||||||
='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.process_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
select * from mmt_staging2.process_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.process_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified);
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified);
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where f1_source is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source);
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source);
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.process_table_deepthi b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTWET';
|
|
||||||
|
|
||||||
update mmt_staging2.process_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where F1_source=column2
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTWET';
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5,column7 c6
|
|
||||||
from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and b.file_format ='FTWET'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTWET'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTWET'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTWET_tractor_specifications_Implement_Details;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Implement_Details
|
|
||||||
as
|
|
||||||
select column2 c1,column3 c2,column4 c3,column5 c4,column6 c5 from mmt_staging2.process_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and a.column2 <> ''
|
|
||||||
and b.f1_modified='Implement Details' and b.file_format ='FTWET'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTWET_tractor_specifications_Implement_Details;
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Season');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet(c1)
|
|
||||||
values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet(c1)
|
|
||||||
values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
(c1) values ('Field Condition');
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c4 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c3)
|
|
||||||
and b.c3='Date of Test')
|
|
||||||
where a.c1='Date of Test' ;
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c6 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c5)
|
|
||||||
and b.c5='Report Date')
|
|
||||||
where a.c1='Report Date';
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Season')
|
|
||||||
where a.c1='Season';
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Type of Soil')
|
|
||||||
where a.c1='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Soil Cone Index (kPa)')
|
|
||||||
where a.c1='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet a
|
|
||||||
set c2=(select c5 from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet b
|
|
||||||
where trim(a.c1)=trim(b.c4)
|
|
||||||
and b.c4='Field Condition')
|
|
||||||
where a.c1='Field Condition';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet;
|
|
||||||
|
|
||||||
drop table if exists mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_Sheet_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5,c6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text,c6::text]) AS val
|
|
||||||
FROM mmt_staging1.FTDRY_tractor_specifications_Tractor_Specifications_Sheet
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications drop column if exists a_c ;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
select * from mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications;
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
Hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
RearTyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear_IN_Kg text,
|
|
||||||
Water_Ballast_Rear_75_ text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Mechanical_Ballast_Front_in_Kg text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
Hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
RearTyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi,
|
|
||||||
Tractor_Weight_kg_Front,
|
|
||||||
Tractor_Weight_kg_Rear,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear_IN_Kg,
|
|
||||||
Water_Ballast_Rear_75_,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTWET_tractor_specifications_Tractor_Specifications
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text]) AS val
|
|
||||||
FROM mmt_staging1.FTWET_tractor_specifications_Engine_RPM_Data
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging1.ftwet_tractor_specifications_implement_details add column a_c text;
|
|
||||||
|
|
||||||
alter table mmt_staging1.ftwet_tractor_specifications_implement_details add column transpose_rownumber serial primary key;
|
|
||||||
|
|
||||||
update mmt_staging1.ftwet_tractor_specifications_implement_details set a_c=concat('a_',transpose_rownumber);
|
|
||||||
|
|
||||||
drop table mmt_staging1.ftwet_tractor_specifications_implement_details_tr;
|
|
||||||
|
|
||||||
create table mmt_staging1.ftwet_tractor_specifications_implement_details_tr
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel text,
|
|
||||||
Cage_Wheel_Width_mm text,
|
|
||||||
Cage_wheel_Weight text,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm text,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm text,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel text,
|
|
||||||
No_of_angles_on_cage_wheel text,
|
|
||||||
No_of_days_of_water_logging text,
|
|
||||||
Depth_of_water_mm text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging1.ftwet_tractor_specifications_implement_details_tr
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Hitch_Category,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel,
|
|
||||||
Cage_Wheel_Width_mm,
|
|
||||||
Cage_wheel_Weight,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel,
|
|
||||||
No_of_angles_on_cage_wheel,
|
|
||||||
No_of_days_of_water_logging,
|
|
||||||
Depth_of_water_mm,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{c1,c2,c3,c4,c5}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[c1::text,c2::text,c3::text,c4::text,c5::text]) AS val
|
|
||||||
FROM mmt_staging1.ftwet_tractor_specifications_implement_details
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text);
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,460 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_format,target_table,f1_modified)
|
|
||||||
values
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_H1','Tractor Specifications Sheet'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_Implement','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_specific_table_deepthi;
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_specific_table_deepthi as
|
|
||||||
select * from mmt_staging1.mmt_staging_generic_table
|
|
||||||
where file_format='FTWET' and sheet_format ='FTWET_TRS'
|
|
||||||
and file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_specific_table_deepthi add column is_rownumber_fetched int;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (TRAILING FROM column2 );
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi set column2 = TRIM (LEADING FROM column2 );
|
|
||||||
|
|
||||||
drop table mmt_staging2.mmt_staging_process_table_deepthi ;
|
|
||||||
|
|
||||||
create table mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
(like mmt_staging2.mmt_staging_specific_table_deepthi);
|
|
||||||
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank int;
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column rank_tag text;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (TRAILING FROM F1_modified) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_modified = TRIM (LEADING FROM F1_modified) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source=F1_modified where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (TRAILING FROM F1_source) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
update mmt_ods.mmt_config set F1_source = TRIM (LEADING FROM F1_source) where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_number_start=(select min(b.row_number)
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and a.file_format='FTWET' and sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where trim(upper(F1_source))=trim(upper(column2))
|
|
||||||
and b.row_number_start=a.row_number
|
|
||||||
and is_rownumber_fetched is null and b.file_format ='FTWET' and
|
|
||||||
b.sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config set row_previous_number=row_number_start-1
|
|
||||||
where file_format ='FTWET' and
|
|
||||||
sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_ods.mmt_config b
|
|
||||||
where b.syspk=a.syspk+1 )
|
|
||||||
where a.file_format='FTWET' and a.sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
/*update mmt_ods.mmt_config set row_read_end = null where f1_modified ='Implement Details' and
|
|
||||||
file_format='FTWET' and sheet_format='FTWET_TRS';*/
|
|
||||||
|
|
||||||
update mmt_ods.mmt_config a
|
|
||||||
set run_time=current_timestamp where a.file_format='FTWET' and sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_TRS_H1'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and b.file_format ='FTWET' and b.sheet_format='FTWET_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_TRS_SPEC'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and b.file_format ='FTWET' and b.sheet_format='FTWET_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_TRS_Engine_RPM'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and b.file_format ='FTWET' and b.sheet_format='FTWET_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
insert into mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
select a.* , RANK () OVER ( ORDER BY row_number),'FTWET_TRS_Implement'
|
|
||||||
from mmt_staging2.mmt_staging_specific_table_deepthi a
|
|
||||||
join mmt_ods.mmt_config b
|
|
||||||
on a.row_number >row_number_start
|
|
||||||
and a.column2 <> ''
|
|
||||||
and (a.row_number< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Implement Details' and b.file_format ='FTWET' and b.sheet_format='FTWET_TRS'
|
|
||||||
order by a.row_number;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_TRS_H1_INT as select * from mmt_staging2.mmt_staging_process_table_deepthi
|
|
||||||
where rank_tag='FTWET_TRS_H1';
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT(column2) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT(column2) values ('Report Date');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT(column2) values ('Season');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT (column2) values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT (column2) values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_INT (column2) values ('Field Condition');
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column5 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Date of Test')
|
|
||||||
where a.column2='Date of Test';
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column7 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column6)
|
|
||||||
and b.column6='Report Date')
|
|
||||||
where a.column2='Report Date';
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Season')
|
|
||||||
where a.column2='Season';
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Type of Soil')
|
|
||||||
where a.column2='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Soil Cone Index (kPa)')
|
|
||||||
where a.column2='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT a
|
|
||||||
set column3=(select column6 from mmt_staging2.FTWET_TRS_H1_INT b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Field Condition')
|
|
||||||
where a.column2='Field Condition';
|
|
||||||
|
|
||||||
CREATE EXTENSION if not exists tablefunc;
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_H1_INT add column a_c text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_INT set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table if exists mmt_staging2.FTWET_TRS_H1_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_H1_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text]) AS val
|
|
||||||
FROM mmt_staging2.FTWET_TRS_H1_INT'
|
|
||||||
-- ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_H1_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_H1_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_H1_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_H1_Block
|
|
||||||
set sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
alter table mmt_staging2.mmt_staging_process_table_deepthi add column a_c text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.mmt_staging_process_table_deepthi set a_c=concat('a_',rank);
|
|
||||||
|
|
||||||
drop table mmt_staging2.FTWET_TRS_SPEC_Block;
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear_in_KG text,
|
|
||||||
Water_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Mechanical_Ballast_Front_in_Kg text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_SPEC_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi ,
|
|
||||||
Tractor_Weight_kg_Front ,
|
|
||||||
Tractor_Weight_kg_Rear ,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear_in_KG ,
|
|
||||||
Water_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Mechanical_Ballast_Front_in_Kg,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTWET_TRS_SPEC''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_SPEC_Block add column file_name text;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_SPEC_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_SPEC_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_SPEC_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_SPEC_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_SPEC_Block
|
|
||||||
set sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_Engine_RPM_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6,column7}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column1::text,column3::text,column4::text,column5::text,column6::text,column7::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTWET_TRS_Engine_RPM''
|
|
||||||
ORDER BY generate_series(1,6),1'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Engine_RPM_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Engine_RPM_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Engine_RPM_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Engine_RPM_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Engine_RPM_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Engine_RPM_Block
|
|
||||||
set sheet_format='FTWET_TRS';
|
|
||||||
|
|
||||||
create table mmt_staging2.FTWET_TRS_Implement_Block
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel text,
|
|
||||||
Cage_Wheel_Width_mm text,
|
|
||||||
Cage_wheel_Weight text,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm text,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm text,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel text,
|
|
||||||
No_of_angles_on_cage_wheel text,
|
|
||||||
No_of_days_of_water_logging text,
|
|
||||||
Depth_of_water_mm text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_staging2.FTWET_TRS_Implement_Block
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Hitch_Category,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel,
|
|
||||||
Cage_Wheel_Width_mm,
|
|
||||||
Cage_wheel_Weight,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel,
|
|
||||||
No_of_angles_on_cage_wheel,
|
|
||||||
No_of_days_of_water_logging,
|
|
||||||
Depth_of_water_mm ,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{column3,column4,column5,column6}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[column3::text,column4::text,column5::text,column6::text]) AS val
|
|
||||||
FROM mmt_staging2.mmt_staging_process_table_deepthi where rank_tag=''FTWET_TRS_Implement''
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text);
|
|
||||||
;
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Implement_Block add column file_name text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Implement_Block
|
|
||||||
set file_name='20210217_FTWET_FC-DHRUV P2-49.96 HP_WET LAND FCW-@H1-2240-WITH JD5050D7-SOUTH.xlsx';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Implement_Block add column file_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Implement_Block
|
|
||||||
set file_format='FTWET';
|
|
||||||
|
|
||||||
alter table mmt_staging2.FTWET_TRS_Implement_Block add column sheet_format text;
|
|
||||||
|
|
||||||
update mmt_staging2.FTWET_TRS_Implement_Block
|
|
||||||
set sheet_format='FTWET_TRS';
|
|
||||||
@@ -1,322 +0,0 @@
|
|||||||
insert into mmt_format_config (f1_modified)values
|
|
||||||
('Objective Of Test'),
|
|
||||||
('Tractor Model'),
|
|
||||||
('Trailer Type'),
|
|
||||||
('Test Condition_1:'),
|
|
||||||
('Test Engineer Comments_1'),
|
|
||||||
('Test Manager Comments_1'),
|
|
||||||
('Test Condition_2:'),
|
|
||||||
('Test Engineer Comments_2'),
|
|
||||||
('Test Manager Comments_2');
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=f1_modified where f1_source is null;
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(trailing from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(leading from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set format='haulage_field_summary' where format is null;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source = replace(f1_source,'_1','');
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_field_summary b
|
|
||||||
where f1_source=column1
|
|
||||||
and b.is_rownumber_fetched is NULL and b.src_table_name='haulage')
|
|
||||||
where a.row_number_start is null and format='haulage_field_summary';
|
|
||||||
|
|
||||||
|
|
||||||
update union_field_summary a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_format_config b
|
|
||||||
where F1_source=column1
|
|
||||||
and b.row_number_start=a.syspk
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source = replace(f1_source,'_2','');
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_field_summary b
|
|
||||||
where f1_source=column1
|
|
||||||
and b.is_rownumber_fetched is NULL and b.src_table_name='haulage')
|
|
||||||
where a.row_number_start is null and format='haulage_field_summary';
|
|
||||||
|
|
||||||
update union_field_summary a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_format_config b
|
|
||||||
where F1_source=column1
|
|
||||||
and b.row_number_start=a.syspk
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
update mmt_format_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_format_config b
|
|
||||||
where b.syspk=a.syspk+1)
|
|
||||||
where a.format='haulage_field_summary';
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists haulage_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
create table haulage_field_summary_tractor_model_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
select * from haulage_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
drop table if exists haulage_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
create table haulage_field_summary_trailer_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Trailer Type' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table haulage_field_summary_test_condition_1;
|
|
||||||
|
|
||||||
create table haulage_field_summary_test_condition_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_1:' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table haulage_field_summary_test_condition_2;
|
|
||||||
|
|
||||||
|
|
||||||
create table haulage_field_summary_test_condition_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition_2:' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
create table haulage_field_summary_engineer_comments_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_1' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
create table haulage_field_summary_engineer_comments_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Engineer Comments_2' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table haulage_field_summary_manager_comments_1;
|
|
||||||
|
|
||||||
create table haulage_field_summary_manager_comments_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments_1' and a.src_table_name ='haulage' and b.format ='haulage_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
alter table haulage_field_summary_test_condition_1 add column a_c text;
|
|
||||||
|
|
||||||
alter table haulage_field_summary_test_condition_1 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update haulage_field_summary_test_condition_1 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
drop table transpose_haulage_field_summary_test_condition_1
|
|
||||||
|
|
||||||
create table transpose_haulage_field_summary_test_condition_1
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Fuel_consumption_Ltr_hr text,
|
|
||||||
Mileage_Km_Ltr text,
|
|
||||||
Average_speed_of_travel_kmph text,
|
|
||||||
Total_distance_travelled_km text,
|
|
||||||
Gear_used_on_Straight_Road text,
|
|
||||||
Straight_road_RPM_Drop text,
|
|
||||||
Gear_used_on_Up_Slope_1 text,
|
|
||||||
Up_Slope_RPM_Drop_1 text,
|
|
||||||
Gear_used_on_Up_Slope_2 text,
|
|
||||||
Up_Slope_RPM_Drop_2 text,
|
|
||||||
Gear_used_on_Down_Slope text,
|
|
||||||
Down_Slope_RPM_Shoot_up text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Mileage_Km_Ltr_2 text,
|
|
||||||
Fuel_consumption_lit_hr_3 text,
|
|
||||||
Mileage_Km_Ltr_3 text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Range_Gear_Shifting text,
|
|
||||||
Speed_Gear_Shifting text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_haulage_field_summary_test_condition_1
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr,
|
|
||||||
Mileage_Km_Ltr,
|
|
||||||
Average_speed_of_travel_kmph,
|
|
||||||
Total_distance_travelled_km,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Mileage_Km_Ltr_2,
|
|
||||||
Fuel_consumption_lit_hr_3,
|
|
||||||
Mileage_Km_Ltr_3,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM haulage_field_summary_test_condition_1
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text);
|
|
||||||
|
|
||||||
alter table haulage_field_summary_test_condition_2 add column a_c text;
|
|
||||||
|
|
||||||
alter table haulage_field_summary_test_condition_2 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update haulage_field_summary_test_condition_2 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
create table transpose_haulage_field_summary_test_condition_12
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Fuel_consumption_Ltr_hr text,
|
|
||||||
Mileage_Km_Ltr text,
|
|
||||||
Average_speed_of_travel_kmph text,
|
|
||||||
Total_distance_travelled_km text,
|
|
||||||
Gear_used_on_Straight_Road text,
|
|
||||||
Straight_road_RPM_Drop text,
|
|
||||||
Gear_used_on_Up_Slope_1 text,
|
|
||||||
Up_Slope_RPM_Drop_1 text,
|
|
||||||
Gear_used_on_Up_Slope_2 text,
|
|
||||||
Up_Slope_RPM_Drop_2 text,
|
|
||||||
Gear_used_on_Down_Slope text,
|
|
||||||
Down_Slope_RPM_Shoot_up text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Mileage_Km_Ltr_2 text,
|
|
||||||
Fuel_consumption_lit_hr_3 text,
|
|
||||||
Mileage_Km_Ltr_3 text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Range_Gear_Shifting text,
|
|
||||||
Speed_Gear_Shifting text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_haulage_field_summary_test_condition_12
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Fuel_consumption_Ltr_hr,
|
|
||||||
Mileage_Km_Ltr,
|
|
||||||
Average_speed_of_travel_kmph,
|
|
||||||
Total_distance_travelled_km,
|
|
||||||
Gear_used_on_Straight_Road,
|
|
||||||
Straight_road_RPM_Drop,
|
|
||||||
Gear_used_on_Up_Slope_1,
|
|
||||||
Up_Slope_RPM_Drop_1,
|
|
||||||
Gear_used_on_Up_Slope_2,
|
|
||||||
Up_Slope_RPM_Drop_2,
|
|
||||||
Gear_used_on_Down_Slope,
|
|
||||||
Down_Slope_RPM_Shoot_up,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Mileage_Km_Ltr_2,
|
|
||||||
Fuel_consumption_lit_hr_3,
|
|
||||||
Mileage_Km_Ltr_3,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Range_Gear_Shifting,
|
|
||||||
Speed_Gear_Shifting,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM haulage_field_summary_test_condition_2
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
|||||||
--issues--
|
|
||||||
should make as text ----->mmt_ods.budni_drawbar_perf_results
|
|
||||||
atmosp_conditions_pressure_kpa,
|
|
||||||
atmosp_conditions_rh_pct,
|
|
||||||
atmosp_conditions_temp_oc,
|
|
||||||
temp_coolant_c,
|
|
||||||
temp_fuel_c,
|
|
||||||
temp_engine_oil_c
|
|
||||||
|
|
||||||
Missing in ----->mmt_ods.budni_drawbar_perf_results
|
|
||||||
travel speed(km/h)
|
|
||||||
fuel consumption (L/h)
|
|
||||||
temperature (Trans.oil)
|
|
||||||
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_H1','Tractor Specifications Sheet'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTDRY','FTDRY_TRS','FTDRY_TRS_Implement','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_H1','Tractor Specifications Sheet'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTWET','FTWET_TRS','FTWET_TRS_Implement','Implement Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_H1','Tractor specifications sheet'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_SPEC','Tractor Specifications'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_Engine_RPM','Engine RPM Data:'),
|
|
||||||
('FTHLG','FTHLG_TRS','FTHLG_TRS_Trailer','Trailer Details')
|
|
||||||
;
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Implement','Make of Implement'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_1','Test Condition_1:'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_1','Test Engineer Comments_1'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_1','Test Manager Comments_1'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Test_Condition_2','Test Condition_2:'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Engineer_Comments_2','Test Engineer Comments_2'),
|
|
||||||
('FTDRY','FTDRY_SUM','FTDRY_SUM_Manager_Comments_2','Test Manager Comments_2')
|
|
||||||
;
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Trail_Type','Trailer Type'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Test_Condition_1','Test Condition_1:'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Engineer_Comments_1','Test Engineer Comments_1'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Manager_Comments_1','Test Manager Comments_1'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Test_Condition_2','Test Condition_2:'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Engineer_Comments_2','Test Engineer Comments_2'),
|
|
||||||
('FTHLG','FTHLG_SUM','FTHLG_SUM_Manager_Comments_2','Test Manager Comments_2')
|
|
||||||
;
|
|
||||||
|
|
||||||
insert into mmt_ods.mmt_config
|
|
||||||
(file_format,sheet_mnemonic,rank_tag,f1_modified)
|
|
||||||
values
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Trac_H1','Tractor Model'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Impement','Make of Implement'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Cage_Wheel','Type of Cage Wheel'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Test_Condition','Test Condition:'),
|
|
||||||
('FTWET','FTWET_SUM','FTWET_SUM_Manager_Comment','Test Manager Comments')
|
|
||||||
;
|
|
||||||
|
|
||||||
@@ -1,386 +0,0 @@
|
|||||||
|
|
||||||
select * from union_tractor_spec order by src_table_name,syspk;
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists mmt_format_config;
|
|
||||||
|
|
||||||
create table mmt_format_config
|
|
||||||
(
|
|
||||||
syspk serial primary key,
|
|
||||||
format varchar,
|
|
||||||
F1_source varchar(100),
|
|
||||||
F1_modified varchar(100),
|
|
||||||
row_number_start int,
|
|
||||||
row_previous_number int,
|
|
||||||
row_read_end int,
|
|
||||||
run_date date not null default CURRENT_DATE,
|
|
||||||
run_sheet_name varchar(100),
|
|
||||||
run_file_time timestamp,
|
|
||||||
run_file_name varchar(250)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
create index i_mmt_format_config_format_F1_modified_run_date
|
|
||||||
on mmt_format_config(format,F1_modified,run_date);
|
|
||||||
|
|
||||||
|
|
||||||
insert into mmt_format_config(f1_modified)
|
|
||||||
values
|
|
||||||
('Tractor Specifications Sheet'),
|
|
||||||
('Tractor Specifications'),
|
|
||||||
('Engine RPM Data:'),
|
|
||||||
('Implement Details');
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=f1_modified;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(trailing from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(leading from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set format='dry_field_spec' where format is null;
|
|
||||||
|
|
||||||
select * from mmt_format_config;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_tractor_spec b
|
|
||||||
where f1_source=column2
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and format='dry_field_spec';
|
|
||||||
|
|
||||||
update mmt_format_config set row_previous_number=row_number_start-1;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_format_config b
|
|
||||||
where b.syspk=a.syspk+1 ) ;
|
|
||||||
|
|
||||||
drop table if exists dry_field_spec_test_instance_1;
|
|
||||||
|
|
||||||
create table dry_field_spec_test_instance_1 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and src_table_name='plough'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
select * from dry_field_spec_test_instance_1;
|
|
||||||
|
|
||||||
drop table if exists dry_field_spec_test_specific_2;
|
|
||||||
|
|
||||||
create table dry_field_spec_test_specific_2 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and src_table_name='plough'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
drop table if exists dry_field_spec_engine_rpm_3;
|
|
||||||
|
|
||||||
create table dry_field_spec_engine_rpm_3 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and src_table_name='plough'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists dry_field_spec_implement_4;
|
|
||||||
|
|
||||||
create table dry_field_spec_implement_4 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Implement Details' and src_table_name='plough'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Report Date');
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Season');
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into dry_field_spec_test_instance_1(column2) values ('Field Condition');
|
|
||||||
|
|
||||||
select * from dry_field_spec_test_instance_1;
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_instance_1 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column5 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Date of Test')
|
|
||||||
where a.column2='Date of Test' ;
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column7 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Report Date')
|
|
||||||
where a.column2='Report Date';
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Season')
|
|
||||||
where a.column2='Season';
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Type of Soil')
|
|
||||||
where a.column2='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Soil Cone Index (kPa)')
|
|
||||||
where a.column2='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from dry_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Field Condition')
|
|
||||||
where a.column2='Field Condition';
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_instance_1 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_instance_1 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_spec_test_instance_1 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
|
|
||||||
create table transpose_dry_field_spec_test_instance_1
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_dry_field_spec_test_instance_1
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_spec_test_instance_1
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text)
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_specific_2 drop column if exists a_c ;
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_specific_2 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_spec_test_specific_2 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_spec_test_specific_2 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
drop table transpose_dry_field_spec_test_specific_2;
|
|
||||||
|
|
||||||
create table transpose_dry_field_spec_test_specific_2
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
Rear_Tyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rront_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear_KG text,
|
|
||||||
Water_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_dry_field_spec_test_specific_2
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
Rear_Tyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rront_Tyre_Pressure_psi,
|
|
||||||
Tractor_Weight_kg_Front,
|
|
||||||
Tractor_Weight_kg_Rear,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear_KG,
|
|
||||||
Water_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_spec_test_specific_2
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,
|
|
||||||
a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table dry_field_spec_engine_rpm_3 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_spec_engine_rpm_3 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_spec_engine_rpm_3 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
|
|
||||||
create table tranpose_dry_field_spec_engine_rpm_3
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into tranpose_dry_field_spec_engine_rpm_3
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_spec_engine_rpm_3
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_45 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table dry_field_spec_implement_4 add column a_c text;
|
|
||||||
|
|
||||||
alter table dry_field_spec_implement_4 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update dry_field_spec_implement_4 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
|
|
||||||
drop table transpose_dry_field_spec_implement_4;
|
|
||||||
|
|
||||||
create table transpose_dry_field_spec_implement_4
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into transpose_dry_field_spec_implement_4
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Hitch_Category,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM dry_field_spec_implement_4
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text
|
|
||||||
,a_10 text);
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,381 +0,0 @@
|
|||||||
drop table if exists mmt_format_config;
|
|
||||||
|
|
||||||
create table mmt_format_config
|
|
||||||
(
|
|
||||||
syspk serial primary key,
|
|
||||||
format varchar,
|
|
||||||
F1_source varchar(100),
|
|
||||||
F1_modified varchar(100),
|
|
||||||
row_number_start int,
|
|
||||||
row_previous_number int,
|
|
||||||
row_read_end int,
|
|
||||||
run_date date not null default CURRENT_DATE,
|
|
||||||
run_sheet_name varchar(100),
|
|
||||||
run_file_time timestamp,
|
|
||||||
run_file_name varchar(250)
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into mmt_format_config(f1_modified)
|
|
||||||
values
|
|
||||||
('Tractor Specifications Sheet'),
|
|
||||||
('Tractor Specifications'),
|
|
||||||
('Engine RPM Data:'),
|
|
||||||
('Implement Details');
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=f1_modified;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(trailing from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(leading from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set format='wet_field_spec' where format is null;
|
|
||||||
|
|
||||||
select * from mmt_format_config;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_tractor_spec b
|
|
||||||
where f1_source=column2
|
|
||||||
and b.is_rownumber_fetched is null)
|
|
||||||
where a.row_number_start is null and format='wet_field_spec';
|
|
||||||
|
|
||||||
update mmt_format_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_format_config b
|
|
||||||
where b.syspk=a.syspk+1 );
|
|
||||||
|
|
||||||
drop table if exists wet_field_spec_test_instance_1;
|
|
||||||
|
|
||||||
create table wet_field_spec_test_instance_1 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications Sheet' and a.src_table_name ='rotavator' and b.format ='wet_field_spec'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
select * from wet_field_spec_test_instance_1;
|
|
||||||
|
|
||||||
drop table if exists wet_field_spec_test_specific_2;
|
|
||||||
|
|
||||||
create table wet_field_spec_test_specific_2 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Specifications' and a.src_table_name ='rotavator' and b.format ='wet_field_spec'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
alter table wet_field_spec_test_specific_2 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
select * from wet_field_spec_test_specific_2 ;
|
|
||||||
------------------------------------------------------------------------------------------
|
|
||||||
drop table if exists wet_field_spec_engine_rpm_3;
|
|
||||||
|
|
||||||
create table wet_field_spec_engine_rpm_3 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Engine RPM Data:' and a.src_table_name ='rotavator' and b.format ='wet_field_spec'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
alter table wet_field_spec_engine_rpm_3 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
----------------------------------------------------------
|
|
||||||
drop table if exists wet_field_spec_implement_4;
|
|
||||||
|
|
||||||
create table wet_field_spec_implement_4 as
|
|
||||||
select a.* from union_tractor_spec a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Implement Details' and a.src_table_name ='rotavator' and b.format ='wet_field_spec'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
alter table wet_field_spec_implement_4 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Date of Test');
|
|
||||||
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Report Date');
|
|
||||||
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Season');
|
|
||||||
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Type of Soil');
|
|
||||||
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Soil Cone Index (kPa)');
|
|
||||||
|
|
||||||
insert into wet_field_spec_test_instance_1(column2) values ('Field Condition');
|
|
||||||
|
|
||||||
alter table wet_field_spec_test_instance_1 add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column5 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column4)
|
|
||||||
and b.column4='Date of Test')
|
|
||||||
where a.column2='Date of Test' ;
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column7 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column6)
|
|
||||||
and b.column6='Report Date')
|
|
||||||
where a.column2='Report Date';
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Season')
|
|
||||||
where a.column2='Season';
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Type of Soil')
|
|
||||||
where a.column2='Type of Soil';
|
|
||||||
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Soil Cone Index (kPa)')
|
|
||||||
where a.column2='Soil Cone Index (kPa)';
|
|
||||||
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 a
|
|
||||||
set column3=(select column6 from wet_field_spec_test_instance_1 b
|
|
||||||
where trim(a.column2)=trim(b.column5)
|
|
||||||
and b.column5='Field Condition')
|
|
||||||
where a.column2='Field Condition';
|
|
||||||
|
|
||||||
alter table wet_field_spec_test_instance_1 add column a_c text;
|
|
||||||
|
|
||||||
update wet_field_spec_test_instance_1 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
create table transpose_wet_field_spec_test_instance_1
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Report_Reference_No text,
|
|
||||||
Objective_Of_Test text,
|
|
||||||
Background_of_Test text,
|
|
||||||
Job_Order_No text,
|
|
||||||
Test_Location text,
|
|
||||||
Soil_Moisture_Content_ text,
|
|
||||||
Soil_Bulk_Density_g_cc text,
|
|
||||||
Test_Engineer text,
|
|
||||||
Test_Operator text,
|
|
||||||
Date_of_Test text,
|
|
||||||
Report_Date text,
|
|
||||||
Season text,
|
|
||||||
Type_of_Soil text,
|
|
||||||
Soil_Cone_Index_kPa text,
|
|
||||||
Field_Condition text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_wet_field_spec_test_instance_1
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Report_Reference_No,
|
|
||||||
Objective_Of_Test,
|
|
||||||
Background_of_Test,
|
|
||||||
Job_Order_No,
|
|
||||||
Test_Location,
|
|
||||||
Soil_Moisture_Content_,
|
|
||||||
Soil_Bulk_Density_g_cc,
|
|
||||||
Test_Engineer,
|
|
||||||
Test_Operator,
|
|
||||||
Date_of_Test,
|
|
||||||
Report_Date,
|
|
||||||
Season,
|
|
||||||
Type_of_Soil,
|
|
||||||
Soil_Cone_Index_kPa,
|
|
||||||
Field_Condition
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,column1::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM wet_field_spec_test_instance_1
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t ( col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text);
|
|
||||||
|
|
||||||
alter table wet_field_spec_test_specific_2 add column a_c text;
|
|
||||||
|
|
||||||
update wet_field_spec_test_specific_2 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
create table transpose_wet_field_spec_test_specific_2
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Tractor_Make text,
|
|
||||||
Tractor_Sr_No text,
|
|
||||||
Tractor_Engine_HP text,
|
|
||||||
FIP_Type text,
|
|
||||||
Hour_Meter_Reading text,
|
|
||||||
Steering_Type text,
|
|
||||||
Transmission_Type text,
|
|
||||||
Wheel_Drive_Type_WD text,
|
|
||||||
EGR_Yes_No text,
|
|
||||||
Brake_Type text,
|
|
||||||
PTO_Type text,
|
|
||||||
Standard_PTO_Speed_RPM text,
|
|
||||||
EPTO_Speed_RPM text,
|
|
||||||
Front_Tyre_Make text,
|
|
||||||
Front_Tyre_Size text,
|
|
||||||
Front_Tyre_Pressure_psi text,
|
|
||||||
RearTyre_Make text,
|
|
||||||
Rear_Tyre_Size text,
|
|
||||||
Rear_Tyre_Pressure_psi text,
|
|
||||||
Tractor_Weight_kg_Front text,
|
|
||||||
Tractor_Weight_kg_Rear text,
|
|
||||||
Tractor_Weight_kg_Total text,
|
|
||||||
Ballasted_Tractor_Accessories text,
|
|
||||||
Mechanical_Ballast_Rear text,
|
|
||||||
Water_Ballast_Rear text,
|
|
||||||
Mechanical_Ballast_Front text,
|
|
||||||
Total_Ballast_Weight text
|
|
||||||
);
|
|
||||||
|
|
||||||
insert into transpose_wet_field_spec_test_specific_2
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Tractor_Model,
|
|
||||||
Tractor_Make,
|
|
||||||
Tractor_Sr_No,
|
|
||||||
Tractor_Engine_HP,
|
|
||||||
FIP_Type,
|
|
||||||
Hour_Meter_Reading,
|
|
||||||
Steering_Type,
|
|
||||||
Transmission_Type,
|
|
||||||
Wheel_Drive_Type_WD,
|
|
||||||
EGR_Yes_No,
|
|
||||||
Brake_Type,
|
|
||||||
PTO_Type,
|
|
||||||
Standard_PTO_Speed_RPM,
|
|
||||||
EPTO_Speed_RPM,
|
|
||||||
Front_Tyre_Make,
|
|
||||||
Front_Tyre_Size,
|
|
||||||
Front_Tyre_Pressure_psi,
|
|
||||||
RearTyre_Make,
|
|
||||||
Rear_Tyre_Size,
|
|
||||||
Rear_Tyre_Pressure_psi,
|
|
||||||
Tractor_Weight_kg_Front,
|
|
||||||
Tractor_Weight_kg_Rear,
|
|
||||||
Tractor_Weight_kg_Total,
|
|
||||||
Ballasted_Tractor_Accessories,
|
|
||||||
Mechanical_Ballast_Rear,
|
|
||||||
Water_Ballast_Rear,
|
|
||||||
Mechanical_Ballast_Front,
|
|
||||||
Total_Ballast_Weight
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM wet_field_spec_test_specific_2
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,
|
|
||||||
a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,
|
|
||||||
a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,
|
|
||||||
a_28 text);
|
|
||||||
|
|
||||||
|
|
||||||
alter table wet_field_spec_engine_rpm_3 add column a_c text;
|
|
||||||
|
|
||||||
update wet_field_spec_engine_rpm_3 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
create table transpose_wet_field_spec_engine_rpm_3
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Low_Idle text,
|
|
||||||
High_Idle text,
|
|
||||||
Rated_RPM text,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO text,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO text
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
insert into transpose_wet_field_spec_engine_rpm_3
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Low_Idle,
|
|
||||||
High_Idle,
|
|
||||||
Rated_RPM,
|
|
||||||
Engine_to_PTO_Ratio_540_PTO,
|
|
||||||
Engine_to_PTO_Ratio_540E_PTO
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM wet_field_spec_engine_rpm_3
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text);
|
|
||||||
|
|
||||||
alter table wet_field_spec_implement_4 add column a_c text;
|
|
||||||
|
|
||||||
update wet_field_spec_implement_4 set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
create table transpose_wet_field_spec_implement_4
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Name_of_Implement text,
|
|
||||||
Type_of_Implement text,
|
|
||||||
Make_of_Implement text,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade text,
|
|
||||||
Cutting_Width_m text,
|
|
||||||
Implement_Weight_Kg text,
|
|
||||||
Span_cm_For_Mounted_Implement text,
|
|
||||||
Hitch_Category text,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement text,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel text,
|
|
||||||
Cage_Wheel_Width_mm text,
|
|
||||||
Cage_wheel_Weight text,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm text,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm text,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel text,
|
|
||||||
No_of_angles_on_cage_wheel text,
|
|
||||||
No_of_days_of_water_logging text,
|
|
||||||
Depth_of_water_mm text,
|
|
||||||
FDPD_TDC_Mar15_008 text
|
|
||||||
);
|
|
||||||
insert into transpose_wet_field_spec_implement_4
|
|
||||||
(
|
|
||||||
Name_of_Implement,
|
|
||||||
Type_of_Implement,
|
|
||||||
Make_of_Implement,
|
|
||||||
No_of_bottoms_Tyne_Disc_Blade,
|
|
||||||
Cutting_Width_m,
|
|
||||||
Implement_Weight_Kg,
|
|
||||||
Span_cm_For_Mounted_Implement,
|
|
||||||
Hitch_Category,
|
|
||||||
Mast_Height_cm_For_Mounted_Implement,
|
|
||||||
Type_of_Cage_Wheel_Half_Cage_wheel_Full_Cage_Wheel,
|
|
||||||
Cage_Wheel_Width_mm,
|
|
||||||
Cage_wheel_Weight,
|
|
||||||
Cage_Wheel_inner_Outer_Ring_Dia_mm,
|
|
||||||
Cage_Wheel_Center_Ring_Dia_mm,
|
|
||||||
Distance_between_RHS_LHS_cage_wheel_Inner_Ring_mm_For_Full_Cage_wheel,
|
|
||||||
No_of_angles_on_cage_wheel,
|
|
||||||
No_of_days_of_water_logging,
|
|
||||||
Depth_of_water_mm,
|
|
||||||
FDPD_TDC_Mar15_008
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column2,column3,column4,column5,column6,column7,column8,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column2::text,column3::text,column4::text,column5::text,column6::text,column7::text,column8::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM wet_field_spec_implement_4
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
insert into mmt_format_config
|
|
||||||
(f1_modified) values
|
|
||||||
('Tractor Model'),
|
|
||||||
('Make of Implement '),
|
|
||||||
('Type of Cage Wheel'),
|
|
||||||
('Test Condition:'),
|
|
||||||
('Test Manager Comments');
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=f1_modified where f1_source is null;
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(trailing from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set f1_source=trim(leading from f1_source);
|
|
||||||
|
|
||||||
update mmt_format_config set format='wet_field_summary' where format is null;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_number_start=(select min(b.syspk)
|
|
||||||
from union_field_summary b
|
|
||||||
where f1_source=column1
|
|
||||||
and b.is_rownumber_fetched is NULL and b.src_table_name='rotavator')
|
|
||||||
where a.row_number_start is null and format='wet_field_summary';
|
|
||||||
|
|
||||||
update union_field_summary a
|
|
||||||
set is_rownumber_fetched=1
|
|
||||||
from mmt_format_config b
|
|
||||||
where F1_source=column1
|
|
||||||
and b.row_number_start=a.syspk
|
|
||||||
and is_rownumber_fetched is null;
|
|
||||||
|
|
||||||
update mmt_format_config set row_previous_number=row_number_start-1 where row_previous_number is null;
|
|
||||||
|
|
||||||
update mmt_format_config a
|
|
||||||
set row_read_end= (select b.row_number_start
|
|
||||||
from mmt_format_config b
|
|
||||||
where b.syspk=a.syspk+1)
|
|
||||||
where a.format='wet_field_summary';
|
|
||||||
|
|
||||||
drop table if exists wet_field_summary_tractor_model_1;
|
|
||||||
|
|
||||||
create table wet_field_summary_tractor_model_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Tractor Model' and a.src_table_name ='rotavator' and b.format ='wet_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists wet_field_summary_make_implement_2;
|
|
||||||
|
|
||||||
create table wet_field_summary_make_implement_2 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Make of Implement ' and a.src_table_name ='rotavator' and b.format ='wet_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists wet_field_summary_test_condition;
|
|
||||||
|
|
||||||
create table wet_field_summary_type_cage_wheel as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Type of Cage Wheel' and a.src_table_name ='rotavator' and b.format ='wet_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table if exists wet_field_summary_test_condition;
|
|
||||||
|
|
||||||
create table wet_field_summary_test_condition as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Condition:' and a.src_table_name ='rotavator' and b.format ='wet_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
drop table wet_field_summary_manager_comments;
|
|
||||||
|
|
||||||
create table wet_field_summary_manager_comments_1 as
|
|
||||||
select a.* from union_field_summary a
|
|
||||||
join mmt_format_config b
|
|
||||||
on a.syspk>=row_number_start
|
|
||||||
and (a.syspk< row_read_end or row_read_end is null)
|
|
||||||
and f1_modified='Test Manager Comments' and a.src_table_name ='rotavator' and b.format ='wet_field_summary'
|
|
||||||
order by a.syspk;
|
|
||||||
|
|
||||||
|
|
||||||
alter table wet_field_summary_test_condition add column a_c text;
|
|
||||||
|
|
||||||
alter table wet_field_summary_test_condition add column transpose_syspk serial primary key;
|
|
||||||
|
|
||||||
update wet_field_summary_test_condition set a_c=concat('a_',transpose_syspk);
|
|
||||||
|
|
||||||
select * from wet_field_summary_test_condition;
|
|
||||||
|
|
||||||
drop table transpose_wet_field_summary_test_condition;
|
|
||||||
|
|
||||||
create table transpose_wet_field_summary_test_condition
|
|
||||||
(
|
|
||||||
dummy text,
|
|
||||||
Test_Condition text,
|
|
||||||
Test_Date text,
|
|
||||||
Tractor_Model text,
|
|
||||||
Engine_RPM_set text,
|
|
||||||
PTO_RPM_set text,
|
|
||||||
Gear_Used text,
|
|
||||||
Nominal_Speed_KMPH text,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass text,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass text,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass text,
|
|
||||||
No_of_passes text,
|
|
||||||
Avg_Depth_of_cut_cm text,
|
|
||||||
Fuel_consumption_lit_hr text,
|
|
||||||
Area_covered_acr_hr text,
|
|
||||||
Fuel_consumption_lit_Acr text,
|
|
||||||
Fuel_consumption_lit_hr_2 text,
|
|
||||||
Area_covered_acr_hr_2 text,
|
|
||||||
Fuel_consumption_lit_Acr_2 text,
|
|
||||||
Trail_Observations text,
|
|
||||||
Engine_Smoke_on_Load text,
|
|
||||||
Engine_acceleration_smoke text,
|
|
||||||
Draft_Response text,
|
|
||||||
Tractor_Steer_ability text,
|
|
||||||
Tractor_braking_performance text,
|
|
||||||
Front_Visibility text,
|
|
||||||
Implement_Accessibility text,
|
|
||||||
Front_Wheel_dragging_at_turning text,
|
|
||||||
Front_end_lifting_during_operation text,
|
|
||||||
RPM_Recovery_Time text,
|
|
||||||
Engine_Vibration text,
|
|
||||||
Engine_Sound text,
|
|
||||||
Implement_Lifting_Lowering_response text,
|
|
||||||
Pulverization_Quality text,
|
|
||||||
Pulverization_Index text,
|
|
||||||
);
|
|
||||||
|
|
||||||
select * from transpose_wet_field_summary_test_condition;
|
|
||||||
|
|
||||||
insert into transpose_wet_field_summary_test_condition
|
|
||||||
(
|
|
||||||
dummy,
|
|
||||||
Test_Condition,
|
|
||||||
Test_Date,
|
|
||||||
Tractor_Model,
|
|
||||||
Engine_RPM_set,
|
|
||||||
PTO_RPM_set,
|
|
||||||
Gear_Used,
|
|
||||||
Nominal_Speed_KMPH,
|
|
||||||
Engine_RPM_Drop_on_straight_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_straight_3rd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_1st_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_2nd_Pass,
|
|
||||||
Engine_RPM_Drop_on_turn_3rd_Pass,
|
|
||||||
No_of_passes,
|
|
||||||
Avg_Depth_of_cut_cm,
|
|
||||||
Fuel_consumption_lit_hr,
|
|
||||||
Area_covered_acr_hr,
|
|
||||||
Fuel_consumption_lit_Acr,
|
|
||||||
Fuel_consumption_lit_hr_2,
|
|
||||||
Area_covered_acr_hr_2,
|
|
||||||
Fuel_consumption_lit_Acr_2,
|
|
||||||
Trail_Observations,
|
|
||||||
Engine_Smoke_on_Load,
|
|
||||||
Engine_acceleration_smoke,
|
|
||||||
Draft_Response,
|
|
||||||
Tractor_Steer_ability,
|
|
||||||
Tractor_braking_performance,
|
|
||||||
Front_Visibility,
|
|
||||||
Implement_Accessibility,
|
|
||||||
Front_Wheel_dragging_at_turning,
|
|
||||||
Front_end_lifting_during_operation,
|
|
||||||
RPM_Recovery_Time,
|
|
||||||
Engine_Vibration,
|
|
||||||
Engine_Sound,
|
|
||||||
Implement_Lifting_Lowering_response,
|
|
||||||
Pulverization_Quality,
|
|
||||||
Pulverization_Index
|
|
||||||
)
|
|
||||||
SELECT *
|
|
||||||
FROM crosstab(
|
|
||||||
'SELECT unnest(''{syspk,src_table_name,column1,column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,is_rownumber_fetched}''::text[]) AS col
|
|
||||||
, row_number() OVER ()
|
|
||||||
, unnest(ARRAY[syspk::text,src_table_name::text,column1::text,column2::text,column3::text,
|
|
||||||
column4::text,column5::text,column6::text,column7::text,column8::text,column8::text,
|
|
||||||
column9::text,column10::text,column11::text,column12::text,is_rownumber_fetched::text]) AS val
|
|
||||||
FROM wet_field_summary_test_condition
|
|
||||||
ORDER BY generate_series(1,15),2'
|
|
||||||
) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text,a_10 text,
|
|
||||||
a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text
|
|
||||||
,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text,a_30 text,
|
|
||||||
a_31 text,a_32 text,a_33 text,a_34 text,a_35 text,a_36 text,a_37 text);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user