Row Constraints API
NotNull
ydata.constraints.rows.constraint.NotNull
Unique
ydata.constraints.rows.constraint.Unique
Bases: RowConstraint
Check that values in the specified columns contain no duplicates.
A row is flagged as violating when its value appears more than once in that column. This is the standard uniqueness / primary-key check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
str | list[str]
|
Column(s) whose values must be unique. |
required |
name
|
str | None
|
Human-readable label shown in engine summaries. |
None
|
GreaterThan
ydata.constraints.rows.constraint.GreaterThan
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
LowerThan
ydata.constraints.rows.constraint.LowerThan
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
Between
ydata.constraints.rows.constraint.Between
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
Positive
ydata.constraints.rows.constraint.Positive
Bases: GreaterThan
NotIncludedIn
ydata.constraints.rows.constraint.NotIncludedIn
Bases: RowConstraint
Check that values in a column are NOT in a specified blocklist.
This is the complement of :class:IncludedIn — rows containing any of
the forbidden values are flagged as violations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Column on which the constraint is applied. |
required |
values
|
list[Any] | Any
|
Single value or list of values that are not allowed. |
required |
name
|
str | None
|
Human-readable label shown in engine summaries. |
None
|
IncludedIn
ydata.constraints.rows.constraint.IncludedIn
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
StringLength
ydata.constraints.rows.constraint.StringLength
Bases: RowConstraint
Check that string values in the specified columns have an acceptable length.
Length is measured in characters after coercing to str. Both bounds
are inclusive. Omit max_length to only enforce a minimum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
str | list[str]
|
Column(s) to check. |
required |
min_length
|
int
|
Minimum allowed string length (inclusive). Defaults to 0. |
0
|
max_length
|
int | None
|
Maximum allowed string length (inclusive). |
None
|
name
|
str | None
|
Human-readable label shown in engine summaries. |
None
|
Monotonic
ydata.constraints.rows.constraint.Monotonic
Bases: RowConstraint
Check that values in a column are monotonically ordered.
Row i is flagged as violating when it breaks the ordering relative to
row i-1. The first row always passes (no predecessor to compare to).
Works with numeric and datetime columns. For strictly increasing/decreasing sequences, equal consecutive values are treated as violations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
columns
|
str | list[str]
|
Column(s) to check. |
required |
increasing
|
bool
|
If |
True
|
strict
|
bool
|
If |
False
|
name
|
str | None
|
Human-readable label shown in engine summaries. |
None
|
Regex
ydata.constraints.rows.constraint.Regex
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
BetweenDates
ydata.constraints.rows.constraint.BetweenDates
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |
RelationConstraint
ydata.constraints.rows.constraint.RelationConstraint
Bases: RowConstraint
Validates that each row's key (matching columns) and value columns match a reference. Key columns must be single values; value columns can be scalar or list of allowed values per key in the reference.
CombineConstraints
ydata.constraints.rows.constraint.CombineConstraints
Bases: RowConstraint
validate(dataset)
Validate the constraint against a dataset.
Args: dataset (Dataset): Dataset to test
Returns:
| Name | Type | Description |
|---|---|---|
pdDataFrame |
DataFrame
|
constraint mask |