Relation:assert

Verifies the current relation and writes an error if the assertion is not hold.

Description

assert all expression

assert exists expression

assert unique expression

assert columns columnlist

Parameters

expression: any valid expression

all: the expression must be true for all rows

exists: the expression must be true for at least one row

unique: the result of the expression unique for all rows

columns: the columns must be present in the relation

columnlist: a comma separated list of valid names

Examples

Using the sample relation films.csv

example result
assert all director == "Godard" Assertion error : all director == "Godard"
assert exists director == "Godard" (passes)
assert unique year Assertion error : unique year
assert unique director . year (passes)
assert columns film, director (passes)
assert columns film, title Assertion error : columns film, title

Comments

Assert is silent if the test pass. Use assert to check consistency of the data.

Assert does only give a warning, not stop the execution.

See also

Expressions compile