views:

29

answers:

2

Hi,

I want to bulk upload data for following entity:

class Person(db.Model):
    name  = db.StringProperty(required=True)
    type  = db.StringProperty(required=True)
    refer = db.SelfReferenceProperty()

What is best way to load this data into appspot ?

Thanks,

A: 

As I assume you are creating object for each entity and the put it in some king of queue that proceed them one by one(or by groups of X). Can`t you just create key object from the reference key(if you have it like string)?

Ilian Iliev
A: 

Presumably your data already has some sort of natural key - or it couldn't include a self reference property. Use generate_key to specify a key name for each loaded entity, and a lambda function for the 'refer' field to generate a key that references the appropriate entity.

Nick Johnson
Part of the problem is data doesn't have natural key. It is hierarchical in nature. Only unique way to identify a model instance is through path in the hierarchy. BTW, thanks for the link. I got know new stuff about bulk loader.
pvncad