Hi,
  When you access those reference properties they are fetched by key.
Unfortunately this will happen serially, which will significantly
impact your performance.  You're not going to avoid the read
operations without changing your schema, but you can at least improve
the performance by doing a batch fetch on all those referenced
entities.  One way to do this would look something like:

  class SomeThing(db.Model):
    ref_prop = db.ReferenceProperty()

    @property
    def ref_prop_key(self):
      return SomeThing.ref_prop.get_value_for_datastore(self)

  thing = db.get(some_thing_key)
  other, entities = db.get([thing.ref_prop_key, thing.another_ref_prop_key])

  This trick is to then *never* directly touch thing.ref_prop because
it will fetch the entity again.


Robert




On Thu, Jan 26, 2012 at 07:30, ikalbeniz <[email protected]> wrote:
> Hi,
>
> I have developed a forum where i have structured the database using
> ReferenceProperties to link forum groups, forums, threads, posts and
> users.. so a group (db.model object) has N forums that have N threads
> with N posts..
>
> I have a problem with the Datastore Read Operations Quota and i think
> than can be because when i get a Group object GAE gives me all tree
> structure so with one get_by_id i have lots of Datastore Read
> Operations..
>
> Can someone confirm that this is ok? How an i avoid GAE do this so if
> i only want to show Group properties values so i dont need to acces
> all forums belongs to the group..
>
> thanks.
>
> --
> 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.
>

-- 
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