eagerload() doesn't need join_depth. it will eagerload what you tell it to, i.e.
query.options(eagerload_all('Article', 'Article', 'Article')) Kees van den Broek wrote: > > Hi, > > All the information I need, I can get in 1 SQL query with this query > and model: > > categories=Article.query.filter(Article.parent == None).all() > > class Article(DefaultEntity): > name = Field(Unicode(64), index=True) > parent = ManyToOne('Article') > children = OneToMany('Article', lazy=False, join_depth=4) > > But I don't want to lazy load all children all the time. So I try to > get this query and model working, and still get the data in 1 SQL > query: > > categories=Article.query.options(eagerload('children')).filter > (Article.parent == None).all() > class Article(DefaultEntity): > name = Field(Unicode(64), index=True) > children = OneToMany('Article') > > I think I need to specify a join_depth along with the eagerload > option, but according to the documentation, there's no such option. > > Thanks, > Kees > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---