Orders Table

Orders Table

Data Contract Template

Data Contract Template

Ensure Retail Orders data is fresh, complete, and reliable before its used downstream.

retail_orders_data_contract.yml

dataset
checks:
  - schema: {}
  - freshness:
      column: created_at
      threshold:
        unit: hour
        must_be_less_than_or_equal: 24
columns:
  - name: order_id
    data_type: string
    checks:
      - missing:
          name: No missing value
  - name: product_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: customer_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: order_quantity
    data_type: integer
    checks:
      - missing:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount
    data_type: float
    checks:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount_currency
    data_type: string
    checks:
      - invalid:
          name: Allowed currency is USD
          valid_values:
            - usd
  - name: billing_address
    data_type: string
    checks:
      - missing:
  - name: shipping_address
    data_type: string
    checks:
      - missing:
  - name: payment_method
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Allowed payment methods
          valid_values:
            - cash
            - credit_card
            - transfer
  - name: order_date
    data_type: dateTime
    checks:
      - missing:
  - name: ship_date
    data_type: dateTime
    checks:
      - missing:
  - name: country_code
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Two-letter country code
          valid_format:
            regex: ^[A-Za-z]{2}$
            name: Exactly two letters
  - name: total_order_value
    data_type: float
    checks:
      - missing:
  - name: created_at
    data_type: dateTime
    checks:
      - missing

retail_orders_data_contract.yml

dataset
checks:
  - schema: {}
  - freshness:
      column: created_at
      threshold:
        unit: hour
        must_be_less_than_or_equal: 24
columns:
  - name: order_id
    data_type: string
    checks:
      - missing:
          name: No missing value
  - name: product_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: customer_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: order_quantity
    data_type: integer
    checks:
      - missing:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount
    data_type: float
    checks:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount_currency
    data_type: string
    checks:
      - invalid:
          name: Allowed currency is USD
          valid_values:
            - usd
  - name: billing_address
    data_type: string
    checks:
      - missing:
  - name: shipping_address
    data_type: string
    checks:
      - missing:
  - name: payment_method
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Allowed payment methods
          valid_values:
            - cash
            - credit_card
            - transfer
  - name: order_date
    data_type: dateTime
    checks:
      - missing:
  - name: ship_date
    data_type: dateTime
    checks:
      - missing:
  - name: country_code
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Two-letter country code
          valid_format:
            regex: ^[A-Za-z]{2}$
            name: Exactly two letters
  - name: total_order_value
    data_type: float
    checks:
      - missing:
  - name: created_at
    data_type: dateTime
    checks:
      - missing

Data contract description

This data contract enforces schema stability, a 24-hour freshness SLA, required identifiers and timestamps, prevents missing or invalid values, and applies controlled formats for currencies, payment methods, and country codes. Together, these checks prevent incomplete or invalid orders from breaking analytics, dashboards, or revenue reporting.

retail_orders_data_contract.yml

dataset
checks:
  - schema: {}
  - freshness:
      column: created_at
      threshold:
        unit: hour
        must_be_less_than_or_equal: 24
columns:
  - name: order_id
    data_type: string
    checks:
      - missing:
          name: No missing value
  - name: product_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: customer_id
    data_type: string
    checks:
      - missing:
          name: No missing values
  - name: order_quantity
    data_type: integer
    checks:
      - missing:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount
    data_type: float
    checks:
      - invalid:
          name: Positive quantity
          valid_min: 1
  - name: discount_currency
    data_type: string
    checks:
      - invalid:
          name: Allowed currency is USD
          valid_values:
            - usd
  - name: billing_address
    data_type: string
    checks:
      - missing:
  - name: shipping_address
    data_type: string
    checks:
      - missing:
  - name: payment_method
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Allowed payment methods
          valid_values:
            - cash
            - credit_card
            - transfer
  - name: order_date
    data_type: dateTime
    checks:
      - missing:
  - name: ship_date
    data_type: dateTime
    checks:
      - missing:
  - name: country_code
    data_type: string
    checks:
      - missing:
      - invalid:
          name: Two-letter country code
          valid_format:
            regex: ^[A-Za-z]{2}$
            name: Exactly two letters
  - name: total_order_value
    data_type: float
    checks:
      - missing:
  - name: created_at
    data_type: dateTime
    checks:
      - missing

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-postgress

# verify the contract locally against a data source

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

# publish and schedule the contract with Soda Cloud

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