Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
bulkload_client key_name & parent not possible?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
Angel  
View profile  
(2 users)  More options Aug 13 2008, 9:42 pm
From: Angel <delag...@gmail.com>
Date: Wed, 13 Aug 2008 18:42:03 -0700 (PDT)
Local: Wed, Aug 13 2008 9:42 pm
Subject: bulkload_client key_name & parent not possible?
Hi,
Using the bulkload_client, I found no way to set a key_name or parent
relation for entities. Are these features planned? Or are they already
in there and I am missing something. For example:

#models.py
class Foo(db.Model):
  name = db.StringProperty()

class Bar(db.Model):
  name = db.StringProperty()
  foo = db.ReferenceProperty(Foo)

#foo.py
from google.appengine.ext import bulkload
foo =   bulkload.Loader('Foo',
                          [('name',str),
                          ])

if __name__ == '__main__':
  bulkload.main(foo)

# bar.py
from google.appengine.ext import bulkload
from models import Foo

class BarLoader(bulkload.Loader):
  def __init__(self):
    bulkload.Loader.__init__(self,'Bar',
                          [('name',str),
                          ('foo',str),
                          ])
  def HandleEntity(self, entity):
    f = Foo.all().filter("name =", entity['foo']).get()
    entity['parent'] = f.key() # doesn't work
    entity['key_name'] = entity['name'] # doesn't work
    entity['foo'] = f.key() # works fine
    return entity
if __name__ == '__main__':
  bulkload.main(BarLoader())


    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.
ilial  
View profile  
(1 user)  More options Aug 14 2008, 7:49 am
From: ilial <samo...@gmail.com>
Date: Thu, 14 Aug 2008 04:49:58 -0700 (PDT)
Local: Thurs, Aug 14 2008 7:49 am
Subject: Re: bulkload_client key_name & parent not possible?
Hi,

Here's my HandleEntity. Hope that helps.

    def HandleEntity(self, entity):
        # setup a unique key for the entity. composed of agency_name +
reference_number
        name = entity['agency_name']+entity['reference_number']
        logging.debug("name="+name)
        newent = datastore.Entity('Contract', name=name)
        newent.update(entity)
        ent = search.SearchableEntity(newent)
        return ent

On Aug 13, 9:42 pm, Angel <delag...@gmail.com> wrote:


    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.
Akume  
View profile  
 More options Sep 28 2008, 4:00 pm
From: Akume <akume...@gmail.com>
Date: Sun, 28 Sep 2008 13:00:48 -0700 (PDT)
Local: Sun, Sep 28 2008 4:00 pm
Subject: Re: bulkload_client key_name & parent not possible?
does that mean you have two of the same entry in the datastore now
though?
shouldn't you remove 'entity' after you've put it's values into
'newent'?

-akume

On Aug 14, 4:49 am, ilial <samo...@gmail.com> wrote:


    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.
End of messages
« Back to Discussions « Newer topic     Older topic »

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