On 5/11/15 5:50 AM, Geo wrote:
I have a base class node:
class Node:
parent= relation(
'Node',
remote_side=[id],
backref=backref(
'children',
collection_class=ordering_list('position'),
order_by=[position],
cascade='all'
)
)
by default the node.children give me a eager loading collection, and
what I want is to have a subclass of the Node but only change the
loading to lazy='dynamic' so on the
sqlalchemy.orm.dynamic.AppenderQuery I can control the loading on the
runtime. Or If I can work on the instance level? I read
the documentation but I can't figure out setting the behaviour for
my case.
eager or lazy loading can be controlled using query loader options,
however the "dynamic" loader specifically isn't compatible with loader
options because it changes the behavior of the attribute at the instance
level using an alternate descriptor. Just build a separate
relationship that has "dynamic" as the loader strategy and use that one
when you want that behavior.
--
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 sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at http://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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.