Skip to content

Clone Model Scenario Result

rburghol edited this page Dec 31, 2019 · 1 revision
  • Insert records into run table using files and dates from a previous run table
  • Will continue to use the same files until a rerun of a given segment creates new files.
insert into scen_model_run_elements (runid, elementid, starttime, endtime, elem_xml, output_file,
   run_date,  host, fullpath, run_summary, run_verified, 
   remote_path, exec_time_mean, verified_date,  
   remote_url,  elemoperators, debugfile, report) 
select 13, a.elementid, a.starttime, a.endtime, a.elem_xml, a.output_file, 
   a.run_date,  a.host, a.fullpath , a.run_summary, a.run_verified, 
   a.remote_path, a.exec_time_mean, a.verified_date,  
   a.remote_url,  a.elemoperators, a.debugfile, a.report
from scen_model_run_elements as a 
left outer join scen_model_element as b 
on (
  b.elementid = a.elementid
)
left outer join scen_model_run_elements as c 
on (
  b.elementid = c.elementid
  and c.runid = 13
  and c.run_date >= '2019-12-01'
)
where b.custom1 = 'cova_runoff'
  and a.runid = 11
  and c.runid is null
;

-- Test to see what is there:
select 12, a.elementid, a.starttime, a.runid, c.runid
from scen_model_run_elements as a 
left outer join scen_model_element as b 
on (
  b.elementid = a.elementid
)
left outer join scen_model_run_elements as c 
on (
  b.elementid = c.elementid
  and c.runid = 12
  and c.run_date >= '2019-12-01'
)
where b.custom1 = 'cova_runoff'
  and a.runid = 11
  and c.runid is not null
;

Clone this wiki locally