Skip to main content

odcr — Open Data Contract Runtime

Check every dataset against its data contract the moment it lands — on any database, lake or cloud.

CI PyPI Python License Docs ODCS

Documentation · Architecture · Quickstart · Adapters · Examples · Contributing


odcr reads ODCS data contracts from your central contract repository and enforces them wherever data arrives — a table, a lakehouse, or files in ADLS, S3, GCS or a landing folder — however it got there: batch, streaming, CDC, events or file drops.

For every batch, micro-batch or file, odcr:

Checks schema (missing columns, wrong types, drift) and quality rules (nulls, duplicates, valid values, row counts, custom SQL)
Decides pass, warn, or fail and quarantine — the exit code stops your pipeline
Notifies the source team and the platform team: Slack, Teams, email, Google Chat, Discord, PagerDuty, Opsgenie, webhooks
Logs every run, check and alert in meta tables created on the platform itself
Reconciles source against target per batch — even Oracle → Snowflake or ADLS files → Databricks
Traces each batch from source to consumption, flagging the stage where rows were lost

Quickstart

pip install "odcr[postgres]"                     # pick your platform: odcr adapters
odcr init my_contracts --adapter postgres        # creates a full project, like dbt init
cd my_contracts
cp .env.example .env                             # fill in the connection (Windows: copy)
odcr doctor                                      # driver, TLS, permissions, meta tables, contracts
odcr seed                                        # optional sample data
odcr run --contract-id orders --batch-id batch-002 --where "load_id = 'batch-002'"
Contract orders v1.0.0 batch=batch-002: FAIL
  orders: FAIL (4 rows, 4 failed, 0 warnings)
    - [failed] orders.order_id.unique: expected = 0, got 1 (unique: no duplicate values)
    - [failed] orders.customer_id.required: expected = 0, got 1 (required: no NULL values)
    - [failed] orders.status.invalidValues: expected = 0, got 1
    - [failed] orders.no_negative_amounts: expected = 0, got 1 (Amounts must never be negative)

Then check new data automatically as it lands:

odcr watch --contract-id orders --batch-column load_id          # every new batch in a table
odcr watch --contract-id orders -C lake                          # every new file in ADLS / S3 / GCS

Adapters

Platforms Install
Files Parquet / CSV / JSON in local folders, network shares, ADLS Gen2, Azure Blob, S3, GCS, MinIO odcr[files]
Embedded DuckDB, SQLite odcr[duckdb], odcr
On-premise / open source PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, IBM Db2, Trino / Starburst / Presto odcr[postgres] [mysql] [sqlserver] [oracle] [db2] [trino]
Azure Databricks, Synapse Analytics, Fabric Warehouse, Azure SQL, Cosmos DB, Azure PostgreSQL / MySQL odcr[databricks] [synapse] [fabric] [sqlserver] [cosmosdb]
AWS Databricks, Redshift, Athena, Aurora / RDS, DocumentDB odcr[databricks] [redshift] [athena] [postgres] [mongodb]
GCP Databricks, BigQuery, Cloud SQL, AlloyDB odcr[databricks] [bigquery] [postgres]
Multi-cloud Snowflake, MongoDB / Atlas odcr[snowflake] [mongodb]

18 adapters; pip install "odcr[all]" installs every driver. Each has a ready-to-run reference project in examples/ and a documentation page. Informatica, Ab Initio, Azure Data Factory, SSIS, Airflow and Databricks Workflows call odcr after they land data — see Integrations.

A contract

apiVersion: v3.0.2
kind: DataContract
id: orders
version: 1.0.0
support:                                    # the source team is notified here
  - {channel: "#orders-alerts", tool: slack, url: "${ORDERS_SLACK_WEBHOOK}"}
  - {channel: orders, tool: teams, url: "${ORDERS_TEAMS_WEBHOOK}"}
  - {channel: orders-team@example.com, tool: email, url: "mailto:orders-team@example.com"}
schema:
  - name: orders
    physicalName: sales.orders              # or abfss://landing@lake.dfs.core.windows.net/orders/*.parquet
    properties:
      - {name: order_id, logicalType: integer, primaryKey: true}
      - name: status
        logicalType: string
        quality:
          - {type: library, metric: invalidValues, arguments: {validValues: [NEW, PAID, SHIPPED]}, mustBe: 0}
      - name: amount
        logicalType: number
        quality:
          - {type: library, metric: nullValues, mustBeLessOrEqualTo: 1, unit: percent, severity: warning}
    quality:
      - {type: library, metric: rowCount, mustBeGreaterThan: 0}
      - {type: sql, query: "SELECT COUNT(*) FROM {object} WHERE amount < 0", mustBe: 0}

Runs everywhere

  • Operating systems: Windows, macOS, Linux and Unix servers — tested in CI on all three major ones.
  • Install: pip, pipx, offline wheelhouses for air-gapped servers, the Dockerfile, Databricks libraries, Azure Functions, AWS Lambda.
  • Security: TLS with verified certificates by default; corporate CA bundles and proxies; secrets from environment variables, .env or secret files; managed identities, IAM roles, key-pair and OAuth. See Security.

Python API

from odcr import ContractRepository, run_contract
from odcr.adapters import get_adapter
from odcr.config import load_config

config = load_config("odcr.yaml")
contract = ContractRepository.from_config(config).get("orders")
with get_adapter(config.connection("main")) as db:
    result = run_contract(contract, db, config, batch_id="42", where="load_id = '42'")
    if not result.passed:
        raise SystemExit(result.summary())

Airflow: from odcr.integrations.airflow import OdcrContractOperator.

Contributing

odcr is community-built. Adapters are the easiest way in: adding one is ~50 lines, and the whole end-to-end suite then runs against your platform. Start with CONTRIBUTING.md and issues labelled good first issue.

Licensed under the Apache License 2.0.

Metadata

Release files for odcr 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for odcr 0.2.1
File Size Uploaded Provenance Actions
odcr-0.2.1.tar.gz 77.6 kB With provenance Details for odcr-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for odcr 0.2.1
File Interpreter ABI Platform Actions
odcr-0.2.1-py3-none-any.whl Python 3 none any Details for odcr-0.2.1-py3-none-any.whl

Total release size: 169.3 kB

Release files / odcr-0.2.1.tar.gz

Download URL odcr-0.2.1.tar.gz
Size 77.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6d23c5c02a6f23a789bb2d3a2df98cb911be731cb258a11187b5828c7ce650db
BLAKE2b-256 checksum
How to use checksums
5c4ca3271297687e3be5c3936be193449a2329aa91331160120cbd49b0b2ec60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Release files / odcr-0.2.1-py3-none-any.whl

Download URL odcr-0.2.1-py3-none-any.whl
Size 91.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e9cbdcc87f60680e8c60aef33a37ba831fd75c8436d5448cbb1ee02beea9e57
BLAKE2b-256 checksum
How to use checksums
1fb34c2eb73de4928614021fddb954413b582beb7f3121460672d058804e15a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

Security for odcr 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for odcr-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page