问题
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