Is your feature request related to a problem? Please describe.
Currently, when creating an instance of using get, find, or insert, the related models are not automatically loaded, and there is no option to enable this behavior. Instead, model.related().reload() has to be called before model.related can be used.
Describe the solution you'd like
There are two options:
Add an init hook to load related models/collections when the class attribute autoload_related is set to True.
Make related models/collections load when the property is read for the first time.
Additional context
Eager loading would also be a helpful feature for use with databases other than sqlite3, but that would be a lot more work than just making things load automatically.
Is your feature request related to a problem? Please describe.
Currently, when creating an instance of using
get
,find
, orinsert
, the related models are not automatically loaded, and there is no option to enable this behavior. Instead,model.related().reload()
has to be called beforemodel.related
can be used.Describe the solution you'd like
There are two options:
autoload_related
is set toTrue
.Additional context
Eager loading would also be a helpful feature for use with databases other than sqlite3, but that would be a lot more work than just making things load automatically.