Modul Qualitätssicherung
http://www.superx-projekt.de/doku/qa_modul/index.htm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
208 lines
4.6 KiB
208 lines
4.6 KiB
-- XML-generiertes SQL-Script fuer psql--von etl_step_fuellen.xsl |
|
|
|
create temp table tmp_etl_action_loadtable( |
|
tid INTEGER, |
|
uniquename VARCHAR(255) , |
|
caption VARCHAR(255) , |
|
filepath VARCHAR(255) not null, |
|
target_table VARCHAR(255) not null, |
|
truncate_table SMALLINT , |
|
with_header SMALLINT default 0 , |
|
delimiter VARCHAR(10) default '^' , |
|
systeminfo_id INTEGER not null, |
|
parent_step_uniquename varchar(255) |
|
|
|
) |
|
; |
|
|
|
|
|
create temp table tmp_etl_step( |
|
tid INTEGER, |
|
uniquename VARCHAR(255) , |
|
caption VARCHAR(255) , |
|
systeminfo_id INTEGER not null, |
|
step_type SMALLINT not null, |
|
step_number SMALLINT not null, |
|
force_continue SMALLINT, |
|
etl_job_id INTEGER , |
|
parent_etl_step_id INTEGER , |
|
etl_action_loadtable_id INTEGER , |
|
parent_step_uniquename varchar(255), |
|
parent_job_uniquename varchar(255), |
|
logfile varchar(255) |
|
|
|
) |
|
; |
|
|
|
create temp table tmp_etl_job( |
|
tid INTEGER, |
|
uniquename VARCHAR(255) , |
|
caption VARCHAR(255) , |
|
systeminfo_id INTEGER not null, |
|
logfile varchar(255) |
|
) |
|
; |
|
|
|
|
|
insert into tmp_etl_job(uniquename,caption,systeminfo_id,logfile) |
|
values ('qa_main','Hauptladeroutine Qualitätssicherung',260,' L_qa_Update.log'); |
|
|
|
delete from tmp_etl_job where 0!= (select count(*) from etl_job J where J.uniquename=tmp_etl_job.uniquename |
|
and J.systeminfo_id=tmp_etl_job.systeminfo_id); |
|
|
|
insert into etl_job(uniquename,caption,systeminfo_id) |
|
select uniquename,caption,systeminfo_id |
|
from tmp_etl_job; |
|
; |
|
|
|
--TIDs zurückschreiben: |
|
update tmp_etl_job set tid=(select S.tid from etl_job S |
|
where S.uniquename=tmp_etl_job.uniquename |
|
and S.systeminfo_id=260 |
|
); |
|
|
|
--ETL-Schritt trans: Transformation |
|
|
|
insert into tmp_etl_step( |
|
uniquename , |
|
caption , |
|
systeminfo_id , |
|
step_type, |
|
step_number, |
|
force_continue, |
|
etl_job_id , |
|
--parent_etl_step_id , |
|
--etl_action_loadtable_id , |
|
parent_step_uniquename, |
|
parent_job_uniquename, |
|
logfile) |
|
select 'qa_trans', |
|
'Hauptladeroutine Qualitätssicherung Ladeschritt trans', |
|
260, |
|
1 as step_type, |
|
1 as step_number, |
|
0 as force_continue, |
|
J.tid as etl_job_id, |
|
'' as parent_step_uniquename, |
|
J.uniquename, |
|
'L_qa_Transformation.log' as logfile |
|
from etl_job J |
|
where J.uniquename='qa_main' |
|
and J.systeminfo_id=260; |
|
|
|
|
|
|
|
delete from etl_step |
|
where systeminfo_id=260 |
|
and etl_job_id in (select distinct T.etl_job_id from tmp_etl_step T); |
|
|
|
insert into etl_step(uniquename , |
|
caption , |
|
systeminfo_id , |
|
step_type, |
|
step_number, |
|
force_continue, |
|
etl_job_id |
|
--parent_etl_step_id , |
|
--etl_action_loadtable_id |
|
) |
|
select uniquename , |
|
caption , |
|
systeminfo_id , |
|
step_type, |
|
step_number, |
|
force_continue, |
|
etl_job_id |
|
from tmp_etl_step T |
|
where T.step_type=1; |
|
|
|
--TIDs zurückschreiben: |
|
update tmp_etl_step set tid=(select S.tid from etl_step S |
|
where S.uniquename=tmp_etl_step.uniquename |
|
and S.systeminfo_id=260 |
|
) where step_type=1; |
|
|
|
|
|
insert into etl_step(uniquename , |
|
caption , |
|
systeminfo_id , |
|
step_type, |
|
step_number, |
|
force_continue, |
|
etl_job_id |
|
--parent_etl_step_id , |
|
--etl_action_loadtable_id |
|
) |
|
select uniquename , |
|
caption , |
|
systeminfo_id , |
|
step_type, |
|
step_number, |
|
force_continue, |
|
etl_job_id |
|
from tmp_etl_step T |
|
where T.step_type=2; |
|
|
|
--TIDs zurückschreiben: |
|
update tmp_etl_step set tid=(select S.tid from etl_step S |
|
where S.uniquename=tmp_etl_step.uniquename |
|
and S.systeminfo_id=260 |
|
) where step_type=2; |
|
|
|
|
|
--parent_step_id ermitteln: |
|
update tmp_etl_step set parent_etl_step_id=(select S.tid from etl_step S |
|
where S.uniquename=tmp_etl_step.parent_step_uniquename |
|
) where systeminfo_id=260 |
|
and step_type=2; |
|
|
|
update etl_step set parent_etl_step_id=(select S.parent_etl_step_id from tmp_etl_step S |
|
where S.tid=etl_step.tid |
|
) where systeminfo_id=260 |
|
and step_type=2; |
|
|
|
|
|
delete from etl_action_loadtable |
|
where systeminfo_id=260 |
|
and uniquename in (select T.uniquename from etl_action_loadtable T); |
|
|
|
insert into etl_action_loadtable(uniquename , |
|
caption , |
|
filepath, |
|
target_table, |
|
truncate_table , |
|
with_header , |
|
delimiter , |
|
systeminfo_id) |
|
select uniquename , |
|
caption , |
|
filepath, |
|
target_table, |
|
truncate_table , |
|
with_header , |
|
delimiter , |
|
systeminfo_id |
|
from tmp_etl_action_loadtable; |
|
|
|
--TIDs zurückschreiben: |
|
update tmp_etl_action_loadtable set tid=(select S.tid from etl_action_loadtable S |
|
where S.uniquename=tmp_etl_action_loadtable.uniquename |
|
and S.systeminfo_id=260 |
|
); |
|
|
|
--parent_step_id ermitteln: |
|
update etl_step set etl_action_loadtable_id=(select S.tid from tmp_etl_action_loadtable S |
|
where S.parent_step_uniquename=etl_step.uniquename |
|
) where systeminfo_id=260 |
|
and step_type=2; |
|
|
|
update etl_step set logfile='L_' || trim(uniquename) || '.log' |
|
where logfile is null; |
|
update etl_job set logfile='L_' || trim(uniquename) || '.log' |
|
where logfile is null; |
|
|
|
drop table tmp_etl_action_loadtable; |
|
drop table tmp_etl_step; |
|
drop table tmp_etl_job; |
|
|
|
|
|
|