-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstrload_task_status.cv
42 lines (42 loc) · 1.01 KB
/
strload_task_status.cv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
create view
strload_task_status
as select
tsk.task_id
, latest_job_id
, exec_count
, tbl.schema_name || '.' || tbl.table_name as dest_table
, submit_time ::timestamp(0)
, start_time ::timestamp(0)
, finish_time ::timestamp(0)
, status
, substring(message, 1, 30) as err_msg
from
strload_tasks tsk
left outer join (
select
task_id
, latest_job_id
, exec_count
, start_time
, finish_time
, status
, message
from
strload_jobs
inner join (
select
max(job_id) as latest_job_id
, count(job_id) as exec_count
from
strload_jobs
group by
task_id
) latest_job
on job_id = latest_job_id
) jobs
using (task_id)
left outer join strload_tables tbl
using (table_id)
order by
task_id
;