Skip to main content

Connect your Data

To test a data contract, the CLI connects to the data source defined in the contract's servers block. The connection details (host, catalog, location, …) live in the contract; credentials are provided as environment variables.

servers:
production:
type: postgres # selects the connection engine
host: localhost
port: 5432
database: postgres
schema: public

Environment variables are also loaded from a .env file in the current working directory (or the nearest parent directory containing one). Already-set environment variables take precedence over values from .env.

# .env
DATACONTRACT_POSTGRES_USERNAME=postgres
DATACONTRACT_POSTGRES_PASSWORD=postgres

Supported connections

tip

Missing a source? Open an issue on GitHub.

Each connection requires the matching optional dependency (extra), or install everything with datacontract-cli[all].