I am not sure I understand the following paragraph in the book:
I have lazy_table = true and a
Field('vertex_id', 'reference vertex', requires=IS_IN_DB(db, '
vtx_vertex.id', '%(id)s'))
In the book it says:
The simple requires values could be added to the Field definitions and the table would still be lazy.
However, requires which take a Set object as the first argument, such as IS_IN_DB, will make a query like
db.sometable.somefield == some_value
which would cause sometable to be defined early. This is the situation saved by on_define.
Does this mean that I should put IS_IN_DB() in the on_define keyword argument?
on_define = lambda table: [table.vertex_id.set_attributes(requires=IS_IN_DB(db, '
vtx_vertex.id', '%(id)s')]
Kind regards,
Annet