Data tests Types:

  1. Singular: tests related to one or two models, can’t be used as a general test to all the other models.

    EX:

    Create a SQL statement in the Tests subfolder

    image.png

  2. Generic: YAML code that is scalable and can be applied to multiple models.

    1. unique
    2. not null
    3. relationships
    4. accepted_values
    
    version: 2
    
    models:
      - name: stg_jaffle_shop__customers
        columns:
          - name: customer_id
            tests:
              - unique
              - not_null
      - name: stg_jaffle_shop__orders
        columns:
          - name: status
            tests:
              - accepted_values:
                  values:
                    ["shipped", "completed", "return_pending", "returned", "placed"]
    
    

Sources Tests:

sources:
  - name: jaffle_shop
    database: jaffle_shop
    schema: dbo
    tables:
      - name: customers
        columns:
          - name: id
            tests:
              - unique
              - not_null
      - name: orders
        columns:
          - name: id
            tests:
              - unique
              - not_null
      - name: payments