Hi

yep, I did refer to Nicks blog, which is a much better approach.
Thanks for pointing that out.

Rgds

T

On Jun 1, 6:01 pm, djidjadji <[email protected]> wrote:
> Hi Tim,
>
> It's not recommended practice to use the Model._property members of the 
> object.
> These variables are implementation dependent.
> Better to use the get_value_for_datastore() method of the Property.
>
> 2010/6/1 Tim Hoffman <[email protected]>:
>
>
>
> > Yep you are doing it wrong.
>
> > You have
>
> > tagresults = models.Tag.all().order(sort_order).filter("name =
> > ",tag_name).fetch(10)
> >        article_keys = [f.article.key() for f in tagresults]
>
> > The minute you reference f.article you have dereferenced article and
> > now have the object, then you
> > are fetching its key then fetching the article.
>
> > Have a look 
> > athttp://groups.google.com.au/group/google-appengine-python/browse_thre...
> > or Nick Johnsons article
> >http://www.google.com/url?sa=D&q=http://blog.notdot.net/2010/01/Refer...
>
> > Put simply you should
> > article_keys = [f._article for f in tagresults]
>
> > Then fetch the articles
>
> > results = models.Article.get(article_keys)
>
> > In your reverse query you are on the right track except
> > you have tags = [t for t in article.tag_set]
>
> > You probably want to do a [t for t in article.tag_set.fetch(100)]  or
> > similiar
> > other wise you will send lots of single fetches.
>
> > I haven't addressed caching.
>
> > You should run appstats before and after any changes so you can see
> > what sort of improvements you are getting.
>
> > Rgds

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" 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/google-appengine?hl=en.

Reply via email to