dbldatagen.constraints.chained_relation module
This module defines the ChainedInequality class
- class ChainedRelation(columns, relation)[source]
Bases:
NoPrepareTransformMixin
,Constraint
ChainedRelation constraint
Constrains one or more columns so that each column has a relationship to the next.
For example if the constraint is defined as ChainedRelation([‘a’, ‘b’,’c’], “<”) then only rows that satisfy the condition a < b < c will be included in the output (where a, b and c represent the data values for the rows).
This can be used to model time related transactions (for example in retail where the purchaseDate, shippingDate and returnDate all have a specific relationship) etc.
Relations supported include <, <=, >=, >, !=, ==
- Parameters:
columns – column name or list of column names as string or list of strings
relation – operator to check - should be one of <,> , =,>=,<=, ==, !=