Dowload app engine ndb entity via bulk exporter / bulk loader

Context:

My model classes inherit the base class:

class BaseModel(ndb.model):
  # commom fields and methods

class SpecificModel(BaseModel):
  # specific fields and methods

Problem:

I want to export SpecificModel objects using the appengine bulkuploader service .

I have a specific configuration file (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 ]

I use the following command to load data:

  appcfg.py download_data --config_file=data_loader.py --filename=data.csv --kind=SpecificModel --url=http://url.appspot.com/_ah/remote_api

When I try to load data, I get the following error :

google.appengine.ext.db.KindError: No implementation for kind 'SpecificModel'

Any clues?

0
source share
1 answer

Check out the source code :

Your model will look in GetImplementationClassthrough

implementation_class = db.class_for_kind(kind_or_class_key)

db ndb, . ndb.Model._kind_map, db, , .

: , / ndb ndb. , .

+2

All Articles