datacontract-cli
The datacontract CLI is an open source command-line tool for working with Data Contracts. It uses data contract YAML files to lint the data contract, connect to data sources and execute schema and quality tests, detect breaking changes, and export to different formats. The tool is written in Python. It can be used as a standalone CLI tool, in a CI/CD pipeline, or directly as a Python library.
What it is and what it does
The datacontract CLI is a command-line tool for managing data contracts—formal specifications that define the structure, quality, and freshness expectations of data products. It reads contract definitions in YAML format (following the Open Data Contract Standard) and validates that actual data in databases matches those specifications by running schema checks, quality assertions, and freshness tests. The tool connects to multiple data platforms and can generate outputs in SQL DDL, HTML, and other formats.
You use it to catch data quality issues early, document data products formally, enforce contracts in CI/CD pipelines, and detect breaking changes between contract versions. It ships with 21 runtime dependencies covering YAML parsing via pyyaml and ruamel.yaml, JSON schema validation via fastjsonschema and jsonschema, cloud SDKs like boto3, and templating via Jinja2 and jinja_partials, so it's a fairly complete toolkit rather than a lightweight utility.
Use it for:
- Validate that a database table conforms to a published data contract before consuming it downstream
- Generate SQL DDL from a data contract YAML to keep schema definitions in sync
- Run schema and quality checks in a CI/CD pipeline whenever a data product is updated
- Import an existing database table into a contract definition to establish a baseline contract
- Detect breaking changes between two versions of a data contract and report them
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A CLI tool for defining, validating, and testing data contracts using the Open Data Contract Standard, with support for schema validation, quality checks, and exports across multiple data platforms.
Yes, if you work with data products or need formal data governance. The tool is actively maintained, has no known vulnerabilities, and solves a real problem in data engineering. Install friction is low. The main consideration is whether your data sources are among the supported platforms and whether you need the full dependency tree; if you only lint YAML contracts without testing live data, the overhead is lighter.
Install
datacontract-cli on PyPI
pip
pip install datacontract-cliuv
uv add datacontract-clipoetry
poetry add datacontract-cliInstalling datacontract-cli
Before you install
Low friction install with a pure Python wheel. Active maintenance with a recent release (2026-08-14) and 1036 repository stars. Supports Python 3.10 through 3.14, though the 21 runtime dependencies (including pydantic, sqlglot, boto3, and Jinja2) mean initial installation pulls a substantial dependency tree.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for enterprise data engineering workflows without licensing concerns.
Quickstart
# Install
pip install datacontract-cli
# Test a data contract
export DATACONTRACT_POSTGRES_USERNAME=user
export DATACONTRACT_POSTGRES_PASSWORD=pass
datacontract test https://datacontract.com/orders-v1.odcs.yaml
# Export to SQL
datacontract export sql https://datacontract.com/orders-v1.odcs.yaml
Requires Python 3.10 or later (supports up to 3.14). Testing against live databases requires appropriate credentials and network access to the target data source.
Verify before relying
- Whether the package can be used as a Python library directly or if CLI invocation is the primary interface
- Performance characteristics when testing large datasets or complex schemas
- Extent of custom export and import capabilities mentioned in the documentation
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<3.15,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 21 — typer, click, pydantic, pydantic-settings, pyyaml, ruamel.yaml, requests, truststore, fastjsonschema, jsonschema, pytz, python-multipart, rich, sqlglot, python-dotenv, boto3, Jinja2, jinja_partials, datacontract-specification, open-data-contract-standard, deepdiff |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,479,387/month — #3,854 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: datacontract_cli-1.1.1-py3-none-any.whl
Keywords: data-contract, data-contracts, odcs, open-data-contract-standard, data-quality, data-governance, data-mesh, data-product, data-engineering, schema, dbt, snowflake, databricks, bigquery
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
datacontract-specificationReads and writes YAML files conforming to the…
permissive · top 5,000 on PyPI
open-data-contract-standardReads and writes YAML files conforming to the…
permissive · top 5,000 on PyPI
snowflake-cliSnowflake CLI is a command-line tool for…
permissive · top 5,000 on PyPI
dbt-coredbt-core transforms raw data in a warehouse…
permissive · top 1,000 on PyPI
dbt-osmosisdbt-osmosis is a CLI tool and Python package…
permissive · top 15,000 on PyPI
sqlmeshSQLMesh is a data transformation framework that…
permissive · top 15,000 on PyPI
elementary-dataElementary OSS is a dbt-native CLI for data…
permissive · top 5,000 on PyPI
squawk-cliLinter that analyzes PostgreSQL migrations and…
permissive · top 15,000 on PyPI
shandy-sqlfmtA command-line SQL formatter that automatically…
permissive · top 5,000 on PyPI
acryl-datahubDataHub's ingestion framework and CLI for…
permissive · top 5,000 on PyPI