Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uhm 8302 basic summary of most recent petl run #333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jobs/refresh-derived-tables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ type: "job-pipeline"
description: "Refresh Derived Tables"
configuration:
jobs:
- type: "iterating-job"
description: "Create destination views and functions"
configuration:
jobTemplate:
path: "create-derived-table-in-warehouse.yml"
iterations:
- tableName: "current_pipeline_summary"
- type: "iterating-job"
description: "Create derived setup tables"
configuration:
Expand Down
44 changes: 44 additions & 0 deletions jobs/sql/derivations/views/current_pipeline_summary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
DROP VIEW if exists current_pipeline_summary;
CREATE VIEW current_pipeline_summary AS
select max(cast(jparent.initiated as date)) as run_date,
max(j.status) as status,
count(*) as count,
null as description,
null as error_message,
min(j.started) as started,
max(j.completed) as completed,
null as uuid,
null as parent_child,
max(jparent.uuid) as parent_uuid
from petl_job_execution j
inner join petl_job_execution jparent on jparent.uuid =
(select top 1 uuid from petl_job_execution pje
where description in ('Refreshing HUMCI data','Refreshing ZL data')
order by initiated desc)
where j.initiated >= jparent.initiated
and j.status = 'SUCCEEDED'
group by j.status

union

select cast(jparent.initiated as date),
j.status,
null,
j.description,
j.error_message,
j.started,
j.completed,
j.uuid,
CASE
when ((j.description like 'Importing from%' and j.description like '% to %') or (j.description like 'Creating derived%'))
then 'child'
else 'parent'
END,
jparent.uuid as parent_uuid
from petl_job_execution j
inner join petl_job_execution jparent on jparent.uuid =
(select top 1 uuid from petl_job_execution pje
where description in ('Refreshing HUMCI data','Refreshing ZL data')
order by initiated desc)
where j.initiated >= jparent.initiated
and j.status <> 'SUCCEEDED';