Data Contract CLI
The datacontract CLI is an open-source command-line tool for working with data contracts. It uses data contract YAML files as Data Contract Specification or ODCS 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.
The Data Contract CLI is fully integrated with Entropy Data. For how testing fits into the data contract workflow, see Test a data contract and the Data Contracts concept.
API Key
Define your API Key as an environment variable:
export ENTROPY_DATA_API_KEY=xxx
Publish Test Results
Pass a data contract's URL to datacontract test to retrieve and test it. Add the --publish option to upload the results to Entropy Data, where they appear in the contract's Data Quality section.
datacontract test command
datacontract test https://<your-entropy-data-host>/<org>/datacontracts/<contract-id> \
--server <server> \
--publish https://<your-entropy-data-host>/api/test-results
<server> is the name of the server defined in the contract (for example, snowflake). Set the data source's credentials as environment variables too — each contract's How to test section shows the exact command for that contract. On Entropy Data Cloud, <your-entropy-data-host> is app.entropy-data.com.
Links
- Data Contract CLI on GitHub