Eager loading relationships #84
RaymondCarlaw
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've noticed that relationships are sort of Lazy Loaded using the getattribute method in the Collection class.
This works wonderfully if the result set is small or, if there are duplicate relations (because of caching). In the case the result set is larger, or there are no duplicates, I think there is merit to eager loading these relationships.
This could be implemented as part of the aql creation, and could be done by creating a sub query within the aql loop that returns the relation. There could be a special case where the target field is _key or _id where the Document function is used.
On another note, if an instantiated class does not have a db reference available, then getting the relation attribute causes a DetatchedInstanceError, I believe None should be returned in this case instead.
Beta Was this translation helpful? Give feedback.
All reactions