2
因此,我試圖用父級使用批量加載程序創建實體。使用批量加載程序上傳實體與父母
我有一個客戶端實體:
class Client(db.Model):
identifier = db.StringProperty()
www_ip = db.StringProperty()
local_ip = db.StringProperty()
status=db.BooleanProperty()
我想創建一個數據entiy爲客戶的孩子。
class Data(db.Model):
songscount = db.IntegerProperty()
nextorder = db.IntegerProperty(default=1)
players = db.ListProperty(str)
previousplayer = db.StringProperty()
存在客戶實體。 Data.yaml是(無前同步碼):
transformers:
- kind: Data
connector: csv
connector_options:
# TODO: Add connector options here--these are specific to each connector.
property_map:
- property: __key__
external_name: key
import_transform: transform.create_deep_key(('Client', '__key__'), ('Data', transform.CURRENT_PROPERTY))
export_transform: transform.key_id_or_name_as_string
- property: nextorder
external_name: nextorder
import_transform: transform.none_if_empty(int)
- property: players
external_name: players
import_transform: transform.none_if_empty(users.User) # Assumes email address
- property: previousplayer
external_name: previousplayer
import_transform: transform.none_if_empty(users.User) # Assumes email address
- property: songscount
external_name: songscount
import_transform: transform.none_if_empty(int)
我明白,無論是transform.create_foreign_key或transform.create_deep_key需要被使用。我不明白的是如何通知我的客戶實體(即父母)。
我發現一個這樣的問題,討論How to set parent for datastrore entity during bulkloading data by appcfg.py on Google App Engine?,但'代碼配置'已被棄用。
感謝