A GATEKEEPER load step is used as a checkpoint to test if the execution of a load should proceed or stop. If the GATEKEEPER is fulfilled, execution of subsequent load steps will proceed. A GATEKEEPER is fulfilled when the logic returns a row/rows.
GATEKEEPER steps can be used alone or together with other load steps. It can also be used with automatically generated loads.
GATEKEEPER steps can be saved as part of a load template.
GATEKEEPER steps can use variables inside the SQL code.
Count rows in table
Create a GATEKEEPER which counts rows in a specific table. If the SELECT clause returns rows, load will continue. Logic can be used to verify that the source table is not empty before the load starts.
SELECT COUNT(*) as cnt FROM pub.z_tmp_table_f_trip HAVING COUNT(*) > 0;
Executed SQL before load:
SELECT count(*) as cntresult FROM (
SELECT COUNT(*) as cnt FROM pub.z_tmp_table_f_trip HAVING COUNT(*) > 0
) as cntquery
Note that GATEKEEPER queries are wrapped in a count query at runtime to prevent large result sets.