## odcs.read()


Read an ODCS contract as conditions.


Usage

``` python
odcs.read(
    source,
    *,
    strict=False,
)
```


Each schema object gives a list of conditions ([OdcsContract.conditions](odcs.OdcsContract.md#sverify.odcs.OdcsContract.conditions)): `required` columns NOT NULL, the `primaryKey` columns `sv.key`, [unique](unique.md#sverify.unique) columns and `duplicateValues` rules `sv.unique`, value sets (`enum`, `invalidValues` with `validValues`) `IN` lists, the bounds in `logicalTypeOptions` comparisons, `rowCount` caps `sv.max_rows`, foreign keys `sv.references`, and `sql` rules of the form `SELECT COUNT(*) FROM {object} WHERE <rows that break it>` that must be 0 the condition that no row is counted. ODCS leaves NULLs to `required`, so on a column that may be NULL a rule on values lets NULL through.

Every other rule (free text, a custom engine's, a pattern, a threshold other than 0, a share of rows) is listed in `unread`, with the reason, and [read](odcs.read.md#sverify.odcs.read) warns.


## Parameters


`source: str | Path | Mapping[str, Any]`  
A file (YAML, or JSON by its `.json` suffix), the document's text, or the document as a dict.

`strict: bool = ``False`  
Raise if any rule is unread. Default False: warn.


## Returns


`OdcsContract`  
An [OdcsContract](odcs.OdcsContract.md#sverify.odcs.OdcsContract).


## Raises


`ValueError`  
The document is no ODCS 3.x contract, or with `strict`, some rule is unread.
