This seems to follow a logic where an antecedent can have multiple rules, and a consequent 1 rule. That is, if an arbitrary number of conditions holds, then make sure that an expectation runs.
Would there be a way to trigger an AND condition of multiple expectations as well? E.g.
“if age >25 and height >190” THEN “expectation1 AND expectation2”
I have been looking into the docs, but I can’t figure out how to do that.
We do not natively support combining expectations using logical operators directly. However, you can achieve this behavior through custom logic in your code by chaining validations together and checking the results.
Using your age example you could check that the ages in a column are less than 25 and the weight less than 190 and use the result to check if the validation passes, and then use an if statement to trigger more expectations. Example:
age = df.expect_column_values_to_be_between(column="age", min_value=25)
height = df.expect_column_values_to_be_between(column="weight", min_value=190)
if age["success"] and weight["success"]: next_expectation = ...