上下文:
我的模型类继承自基类:
class BaseModel(ndb.model):
# commom fields and methods
class SpecificModel(BaseModel):
# specific fields and methods
问题:
我想使用appengine bulkuploader service导出SpecificModel实体。
我已经定义了配置文件(data_loader.py):
import sys
sys.path.append('.') ## this is to ensure that it finds the file 'models.py'
from google.appengine.ext import ndb
from google.appengine.tools import bulkloader
from models import *
class SpecificModelExporter(bulkloader.Exporter):
def __init__(self):
bulkloader.Exporter.__init__(self, 'SpecificModel',
[('fieldOne', str, None),
('fieldTwo', str, None)
])
exporters = [ SpecificModelExporter ]
我使用以下命令下载数据:
appcfg.py download_data --config_file=data_loader.py --filename=data.csv --kind=SpecificModel --url=http://url.appspot.com/_ah/remote_api
当我尝试下载数据时,我收到以下错误:
google.appengine.ext.db.KindError: No implementation for kind 'SpecificModel'
任何线索?
答案 0 :(得分:2)
查看source code:
您的模型将在GetImplementationClass
通过
implementation_class = db.class_for_kind(kind_or_class_key)
但db
模型的注册表不会包含您定义的任何ndb
模型。在ndb.Model._kind_map
中创建了类似的注册表,并且在那里找不到您定义的任何db
模型。
注意:到目前为止as I can tell,在批量加载程序或等效的ndb
批量加载程序中没有相应的问题/功能请求要求ndb
支持。可能值得归档并主演它。