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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---