AppEngine bulk loader and automatically created property values

烂漫一生 提交于 2019-12-08 06:45:35

问题


In my model I have a property:

created = db.DateTimeProperty(required=True, auto_now_add=True)

When an object of this type is created in the datastore, the created property is automatically populated.

When I use the bulk loader tool with a table which does not have this field, the field is not automatically populated when I upload to AppEngine, at which time new objects are created.

How can I make it set the created time on new objects uploaded from the bulk loader?


回答1:


Add something like the following to bulkloader.yaml:

- property: created
  external_name: created
  import_transform: "lambda x: datetime.datetime.utcnow()"


来源:https://stackoverflow.com/questions/4766055/appengine-bulk-loader-and-automatically-created-property-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!