开发者

How to bulk upload in App Engine with reference field?

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.Sel开发者_如何学运维fReferenceProperty()

What is best way to load this data into appspot?

Thanks,


The method you want to use is deprecated. Try to use YAML configuration file for bulk uploading.

You can see the tutorial here: Google App Engine, Uploading and Downloading Data


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜