尝试使用 python GeoModel 类和bulkloader。我正在调用以下内容post_import_function
,它可以正常工作,并且实体已使用正确设置的位置字段进行更新。
def post_process_obj(input_dict, entity_instance, bulkload_state):
entity_instance['location'] = db.GeoPt(entity_instance['latitude'], entity_instance['longitude'])
return entity_instance
但我需要做的是entity_instance.update_location()
在实体保存到数据存储之前调用实体。虽然是一个实体,而entity_instance
不是 GeoModel 的子类,所以我不清楚如何做到这一点。前段时间有一篇文章说内联代码或调用函数并将实体传递给它,但我不知道那应该是什么意思。
感谢您提供任何帮助/示例代码。