Skip to content

check_source_freshness_tests

This check validates that a source has specified a 'freshness' test for all of its tables.

In the example below, the orders table has specified a freshness test, while the customers table has not.

sources:
  - name: poffertjes
    tables:
      - name: orders
        freshness:
          error_after:
            count: 1
            period: day
      - name: customers

This check would flag the customers table as missing a source freshness test.

Parameters

This check does not support any custom parameters.

Info

For more information about how to set custom parameters for a check, see the documentation on configuration.

Source

def check(source: dict):
    warning_defined = source["freshness"]["warn_after"]["period"] is not None
    error_defined = source["freshness"]["error_after"]["period"] is not None
    assert warning_defined or error_defined