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
Streaming Apache Kafka (Confluent, MSK, Redpanda, Aiven), Azure Event Hubs odcr-kafka odcr-eventhubs
On-premise / open source PostgreSQL (Greenplum, CockroachDB, YugabyteDB, TimescaleDB), MySQL, MariaDB, SQL Server, Oracle, IBM Db2, Teradata, SAP HANA, Vertica, ClickHouse, Trino / Starburst / Presto odcr-postgres odcr-mysql odcr-sqlserver odcr-oracle odcr-db2 odcr-teradata odcr-saphana odcr-vertica odcr-clickhouse odcr-trino
Hadoop Hive, Spark SQL (Thrift server), Impala — Cloudera, EMR, Dataproc, HDInsight odcr-hive odcr-impala
Azure Databricks, Synapse Analytics, Fabric Warehouse, Azure SQL, Cosmos DB, Event Hubs, Azure PostgreSQL / MySQL odcr-databricks odcr-synapse odcr-fabric odcr-sqlserver odcr-cosmosdb odcr-eventhubs
AWS Databricks, Redshift, Athena, Aurora / RDS, DocumentDB odcr-databricks odcr-redshift odcr-athena odcr-postgres odcr-mongodb
GCP Databricks, BigQuery, Cloud SQL, AlloyDB odcr-databricks odcr-bigquery odcr-postgres
Multi-cloud Snowflake, MongoDB / Atlas, ClickHouse Cloud, Teradata VantageCloud odcr-snowflake odcr-mongodb odcr-clickhouse odcr-teradata

26 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.2

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.2
File Size Uploaded Provenance Actions
odcr-0.2.2.tar.gz 88.8 kB With provenance Details for odcr-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 195.9 kB

Release files / odcr-0.2.2.tar.gz

Download URL odcr-0.2.2.tar.gz
Size 88.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3578732033c4516fb12f96a75b91979ab8af8c9bc9d011fa0a09833e6cefa7c6
BLAKE2b-256 checksum
How to use checksums
49204b9182810311661f85a76c2e70db82e5d535ca5fd722c3ce2d1012a4ba67
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.2-py3-none-any.whl

Download URL odcr-0.2.2-py3-none-any.whl
Size 107.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0eacdcf182d382e0c98f4c396486aa3db792b7b9ba7963a61e01ada943f5bc20
BLAKE2b-256 checksum
How to use checksums
58cd575098fb90990c373d2786f65cd6b4b6b3e9dde15e7eb2aae1608e1aeae7
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.2

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.2.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