web2py has other operators that provide an API to access equivalent SQL operators. Let’s deﬁne another table "log" to store security events, their timestamp and severity, where the severity is an integer number.
1 2 3
db.define_table('log', Field('event'), Field('timestamp', 'datetime'), Field('severity', 'integer'))
As before, insert a few events, a "port scan", an "xss injection" and an "unauthorized login". For the sake of the example, you can log events with the same timestamp but with different severities (1, 2, 3 respectively).