class Expression

Expression is a subclass of Producer that produces the results of aggregations and mathematical operations involving Producer objects. Must be used in a rule or query context.


You create an Expression object when you use an operator like > with a Producer object:

import relationalai as rai

model = rai.Model("people")
Person = model.Type("Person")

with model.rule():
   Person.add(name="Fred", age=39)
   Person.add(name="Wilma", age=36)

with model.query() as select:
    person = Person()
    # Restrict `person.age` to values strictly greater than 36
    # and return an `Expression` object.
    person.age > 36
    response = select(

# Output:
#    name
# 0  Fred

The following operators are supported:

See Also#