开发者

post_import_function in App Engine bulkuploader yaml

I am trying to use post_import_function while uploading data using bulkloader.yaml. As per this link, Using post_import_function in App Engine bulkuploader yaml , I am using type google.appengine.api.datastore.Entity for entity operations. As in the link, this is a subclass of 'dict'. However I am not sure how do I apply methods to this entity.

My code looks like (I am using Geomodel):

   def post_import_restaurants(input_dict, instance, bulkload_state_copy):

        lat = instance['lat']
        lng = instance['lng']
        latlng = "%s,%s" % (lat,lng)
        instance['location'] = db.GeoPt(latlng)
        instance.update_location()
        return instance

instance.update_l开发者_运维问答ocation(), is where I am having issues. And I am not sure how to write this statement.


You can't add methods to an Entity. Just inline the code, or write it as a separate function that you pass the entity to.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜