On 03/13/2016 04:46 PM, Kate Boelhauf wrote:
I just learned about dynamic loading and was able to implement that so
that I could filter on a relationship

matched_objects = foo.relationship.filter(RelationshipClass.property
=="mustmatch").all()
if len(matched_objects) > 0:
     continue

Currently I typically loop and check to see if the property matches, I'd
prefer to do the dynamic loading but was wondering if I would take a
penalty on speed if I used it a lot.

the dynamic loader is all about tradeoffs. It emits SQL every time you access it, which has a speed penalty vs. having the whole collection loaded into memory at once. However, if the collection itself is millions of rows, that's a non-starter as well, so it depends on what kind of data you are accessing what approach is more performant in the aggregate.





--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to