SMOKE_BLACK
SMOKE_BLACK load steps can be used to execute data smoke tests as part of load workflows. A SMOKE_BLACK test result will be logged, and a failure will also fail the workflow and stop any subsequent, dependent loads from executing to prevent errors from spreading.
See also:
Usage
SMOKE_BLACK: sql_code
Notes
A SMOKE_BLACK test fails if the test SQL returns any rows.
SMOKE_BLACK steps can be used alone or together with other load steps. They can also be used with automatically generated loads.
SMOKE_BLACK steps can be saved as part of a load template.
SMOKE_BLACK steps can use variables inside the SQL code.
Examples
Test to check whether duplicates exist target table
The following SQL uses variables, so the test can also be templated and used in similar tables without further modification (other than possibly the group by key). The SQL clause checks whether there are duplicates in the target table and stops the data load in case rows are found.
SMOKE_BLACK step defined in a load:
-- Duplicates Smoke Test
SELECT 1
FROM <target_schema>.<target_entity_name>
GROUP BY dv_id
HAVING COUNT(1) > 1;
Test executed in the target database for example entity DV.S_RATECODE:
SELECT COUNT(*) AS cntresult FROM (
-- Duplicates Smoke Test
SELECT 1
FROM DV.S_RATECODE
GROUP BY dv_id
HAVING COUNT(1) > 1;
) AS cntquery
Note that Agile Data Engine wraps smoke tests in an additional count query during execution to avoid large result sets.
There is also a more efficient way to test for duplicates in large entities. If you are using Run ID Logic see this example, and if not, see this example.