Closed stefannegele closed 7 months ago
models:
my_table:
description: contains data
required:
- primary_key
unique:
- primary_key
constraints: # this is new
model_constraint:
type: check
expression: "primary_key > 0"
fields:
my_column:
description: contains values
type: text
constraints: # this is new
primary_key_constraint:
type: primary_key
check_constraint:
type: check
expression: "my_column == my_column"
type: table
I think this is obsolete with the current formats and https://github.com/datacontract/datacontract-specification/issues/55
It would be nice to have the possibility to add field constraints to a Field Object because with the current state of the specification, the data contract cannot contain constraint (e.g. nullability) information on a field.
Since field existence (
required
ornullable
) and uniqueness (unique
) are so omnipresent and important, I would make them first level citizens in the field object. All other constraints can live in a fieldconstraints
similar to how dbt does it. My idea how to store such information in the contract is: