Add test config

This commit is contained in:
Derry Hamilton 2019-08-05 11:32:24 +01:00
parent 8fdbc6a78e
commit 4f905dd47a
2 changed files with 58 additions and 4 deletions

View file

@ -98,5 +98,59 @@
OR denormalised_personalia.lname is distinct from EXCLUDED.lname OR denormalised_personalia.lname is distinct from EXCLUDED.lname
</insert> </insert>
</job> </job>
<job>
<name>test pre post</name>
<key>select -1 as key</key>
<select>
select
id,
test_int,
test_text,
test_ts
from
public.source where id > ?::bigint
</select>
<preTarget>
drop table if exists tmp_dest;
create temp table tmp_dest(
id bigint,
test_int integer,
test_text text,
test_ts timestamp with time zone
);
</preTarget>
<insert>
insert into tmp_dest(
id,
test_int,
test_text,
test_ts
)values(
?::bigint,
?::integer,
?::text,
?::timestamp with time zone
)
</insert>
<insert>
insert into public.dest(
id,
test_int,
test_text,
test_ts
)
select id,test_int,test_text,test_ts
from tmp_dest
ON CONFLICT(id) DO UPDATE
set
test_int = EXCLUDED.test_int,
test_text = EXCLUDED.test_text,
test_ts = EXCLUDED.test_ts
WHERE
dest.test_int IS DISTINCT FROM EXCLUDED.test_int
OR dest.test_text IS DISTINCT FROM EXCLUDED.test_text
OR dest.test_ts IS DISTINCT FROM EXCLUDED.test_ts
</insert>
</job>
</jobs> </jobs>
</CopyingApp> </CopyingApp>

View file

@ -180,12 +180,12 @@ public class Job extends Thread {
log.info(String.format("%s - Processing table: %s",jobName,name)); log.info(String.format("%s - Processing table: %s",jobName,name));
if(preTarget != null){ if(preTarget != null){
log.debug("Trying to execute preTarget SQL"); log.info("Trying to execute preTarget SQL");
PreparedStatement s = dConn.prepareStatement(preTarget); PreparedStatement s = dConn.prepareStatement(preTarget);
s.executeUpdate(); s.executeUpdate();
s.close(); s.close();
}else{ }else{
log.debug("No preTarget; skipping."); log.info("No preTarget; skipping.");
} }
log.debug("Trying to execute: "+key); log.debug("Trying to execute: "+key);
@ -225,12 +225,12 @@ public class Job extends Thread {
c.join(); c.join();
if(postTarget != null){ if(postTarget != null){
log.debug("Trying to execute postTarget SQL"); log.info("Trying to execute postTarget SQL");
PreparedStatement s = dConn.prepareStatement(postTarget); PreparedStatement s = dConn.prepareStatement(postTarget);
s.executeUpdate(); s.executeUpdate();
s.close(); s.close();
}else{ }else{
log.debug("No postTarget; skipping."); log.info("No postTarget; skipping.");
} }