为 db.polymodel.PolyModel 类型的实体批量上传失败并出现以下错误(我已设法上传其他实体并且所有导入都应该存在):
[INFO ] Logging to bulkloader-log-20130901.191015
[INFO ] Throttling transfers:
[INFO ] Bandwidth: 250000 bytes/second
[INFO ] HTTP connections: 8/second
[INFO ] Entities inserted/fetched/modified: 20/second
[INFO ] Batch Size: 10
Traceback (most recent call last):
File "c:/program files (x86)/google/google_appengine/appcfg.py", line 171, in
<module>
run_file(__file__, globals())
File "c:/program files (x86)/google/google_appengine/appcfg.py", line 167, in
run_file
execfile(script_path, globals_)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4252, in <module>
main(sys.argv)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 4243, in main
result = AppCfgApp(argv).Run()
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 2402, in Run
self.action(self)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3979, in __call__
return method()
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3791, in PerformUpload
run_fn(args)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\ap
pcfg.py", line 3682, in RunBulkloader
sys.exit(bulkloader.Run(arg_dict))
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4395, in Run
return _PerformBulkload(arg_dict)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 4206, in _PerformBulkload
LoadConfig(config_file)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 3873, in LoadConfig
Loader.RegisterLoader(cls())
File "SubscribLoader.py", line 23, in __init__
('description', lambda x: x.decode('utf-8')),
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 2674, in __init__
GetImplementationClass(kind)
File "c:\program files (x86)\google\google_appengine\google\appengine\tools\bu
lkloader.py", line 968, in GetImplementationClass
implementation_class = db.class_for_kind(kind_or_class_key)
File "c:\program files (x86)\google\google_appengine\google\appengine\ext\db\_
_init__.py", line 296, in class_for_kind
raise KindError('No implementation for kind \'%s\'' % kind)
google.appengine.ext.db.KindError: No implementation for kind 'DbSubscrib
' 这是命令行:
appcfg.py upload_data --config_file=SubscribLoader.py --filename=Subscrib.csv --
kind=(DbProduct,DbSubscrib) --url=https://.../_ah/remote_api -A appname
这是加载器类
import datetime
from google.appengine.tools import bulkloader
from Db.shop.DbSubscrib import DbSubscrib
class SubscribLoader (bulkloader.Loader):
def __init__(self):
bulkloader.Loader.__init__(self, ('DbProduct','DbSubscrib'),
[
('name', lambda x: x.decode('utf-8')),
('createDate',
lambda x: datetime.datetime.strptime(x, '%m/%d/%Y').date()),
('level', lambda x: x.decode('utf-8')),
('duration', lambda x: x.decode('utf-8')),
('service', lambda x: x.decode('utf-8')),
('description', lambda x: x.decode('utf-8')),
])
loaders = [SubscribLoader]
DbSubcrib 派生自 DbProduct,它从 polymodel.PolyModel 驱动
顺便说一句,我尝试添加另一个硬编码到 DbSubscrib 的额外属性“类”(还尝试添加 2 个属性“DbProduct”和“DbSubscrib”,但没有任何运气。
任何帮助深表感谢。我在 goole 的网站上找不到涉及 PolyModel 和批量上传的任何细微差别的文档。