General

General

Data Contract Template

Data Contract Template

Boilerplate data contract to ensure data is fresh, complete, and reliable before its used downstream.

general_data_contract.yml

dataset
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
columns:
  - name: id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: date
    data_type: timestamp
    checks:
      - missing:
  - name: column_1
    data_type: varchar
    checks:
      - missing:
      - invalid:
          valid_min_length: 1
          valid_max_length: 255
  - name: column_2
    data_type: varchar
    checks:
      - invalid:
          valid_values: ["C", "A", "D"]
  - name: column_3
    data_type: integer
    checks:
      - aggregate:
          function: avg
          threshold:
            must_be_between:
              greater_than: 20
              less_than: 50

general_data_contract.yml

dataset
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
columns:
  - name: id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: date
    data_type: timestamp
    checks:
      - missing:
  - name: column_1
    data_type: varchar
    checks:
      - missing:
      - invalid:
          valid_min_length: 1
          valid_max_length: 255
  - name: column_2
    data_type: varchar
    checks:
      - invalid:
          valid_values: ["C", "A", "D"]
  - name: column_3
    data_type: integer
    checks:
      - aggregate:
          function: avg
          threshold:
            must_be_between:
              greater_than: 20
              less_than: 50

Data contract description

This data contract enforces schema stability, it prevents missing or duplicate IDs, blocks missing timestamps, and applies basic validity guardrails such as minimum/maximum lengths for key text fields. Together, these checks catch broken loads, malformed records, and structural changes early.

general_data_contract.yml

dataset
checks:
  - schema:
      allow_extra_columns: false
      allow_other_column_order: false
  - row_count:
      threshold:
        must_be_greater_than: 0
columns:
  - name: id
    data_type: varchar
    checks:
      - missing:
      - duplicate:
  - name: date
    data_type: timestamp
    checks:
      - missing:
  - name: column_1
    data_type: varchar
    checks:
      - missing:
      - invalid:
          valid_min_length: 1
          valid_max_length: 255
  - name: column_2
    data_type: varchar
    checks:
      - invalid:
          valid_values: ["C", "A", "D"]
  - name: column_3
    data_type: integer
    checks:
      - aggregate:
          function: avg
          threshold:
            must_be_between:
              greater_than: 20
              less_than: 50

How to Enforce Data Contracts with Soda

Embed data quality through data contracts at any point in your pipeline.

Embed data quality through data contracts at any point in your pipeline.

# pip install soda-{data source} for other data sources

# pip install soda-{data source} for other data sources

pip install soda-postgress

pip install soda-postgress

# verify the contract locally against a data source

# verify the contract locally against a data source

soda contract verify -c contract.yml -ds ds_config.yml

soda contract verify -c contract.yml -ds ds_config.yml

# publish and schedule the contract with Soda Cloud

# publish and schedule the contract with Soda Cloud

soda contract publish -c contract.yml -sc sc_config.yml

soda contract publish -c contract.yml -sc sc_config.yml

Check out the CLI documentation to learn more.

Check out the CLI documentation to learn more.

How to Automatically Create Data Contracts.
In one Click.

Automatically write and publish data contracts using Soda's AI-powered data contract copilot.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

Make data contracts work in production

Business knows what good data looks like. Engineering knows how to deliver it at scale. Soda unites both, turning governance expectations into executable contracts.

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by

4.4 of 5

Start trusting your data. Today.

Find, understand, and fix any data quality issue in seconds.
From table to record-level.

Trusted by