Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion ReferenceProperty - id access without fetching the entity
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rafe  
View profile  
 More options Oct 2 2008, 6:02 pm
From: Rafe <slobberch...@gmail.com>
Date: Thu, 2 Oct 2008 15:02:01 -0700 (PDT)
Local: Thurs, Oct 2 2008 6:02 pm
Subject: Re: ReferenceProperty - id access without fetching the entity
  Mazia is correct, there is no guarantee that this will work.  In
fact, it is very likely it will not work in the future.  We may in the
future implement lazy loading so that you can access the key directly
without loading the entity (a.C.key()) however, for now, this is
guaranteed to work:

  A.C.get_value_for_datastore(a).key()

On Sep 29, 6:23 pm, Andy Freeman <ana...@earthlink.net> wrote:

> Is there an approved way to copy a ReferenceProperty from one entity
> to another without fetching the referred to entity from the datastore?

> In other words,

> class C(db.Model):
>     ...

> class A(db.Model):
>     C = db.ReferenceProperty(reference_class=C)

> class B(db.Model):
>     C = db.ReferenceProperty(reference_class=C)

> a = {some query}
> b = B()
> # I would like to do the next assignment without retrieving the
> relevant entity
> # from the data store.
> b.C = a.C

> Yes, I know that a._C.id() can be used to read the id, but that
> doesn't seem to be part of the documented interface.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google