Skip to content

Count Verification with Jinja Example

  • Use case: Use an ingredient to load a table into snowflake and verify that the record count is accurate.
  • Example recipe: the ingredient variation triggers a Matillion job, which loads a table in a Snowflake database from a CSV file. The process writes a count at runtime to an outflowing variable. A count verification test has been written to pull the value from the JSON variable, cast it to an integer, and compare it against a scalar value using the Jinja expression editor.

Step 1: Define runtime variable

Configure the ingredient variation to export the runtime value as the output_matillion_dict variable with the value recorded in the output_raw_record_count key.

Visual example in Automation

(Screenshot of incoming and outgoing variables list)

Summary of how-to

An outflowing variable from the run of an ingredient variation can be used in testing. For more details, see Declare Ingredients.

Step 2: Configure test

The recipe builder writes the test as defined in the UI. This test makes sure that the record count of the table data equals the original row count of the CSV file.

Visual example in Automation

The test verifies that the output record count equals the expected 5926.

(Screenshot of the Tests tab)

Summary of how-to

Follow the steps in Declare Tests to set up the test.

Use the radio button to select Specify Jinja expression for the Test Logic. The Expression includes the outflowing variable defined in Step 1.