dowload app engine ndb entities via bulk exporter / bulk uploader
Asked Answered
A

1

0

Context:

My model classes inherit from a base class:

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

class SpecificModel(BaseModel):
  # specific fields and methods

Problem:

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

I have the defined the config 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 download 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 download the data I get the following error:

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

Any clues?

Appetizing answered 26/11, 2012 at 19:11 Comment(0)
J
2

Have a look at the source code:

Your model will be looked up in GetImplementationClass via

implementation_class = db.class_for_kind(kind_or_class_key)

but the registry of db models will not include any ndb models you've defined. A similar registry is created in ndb.Model._kind_map and any db models you had defined would not be found there.

NOTE: As far as I can tell there is no corresponding issue/feature request asking for ndb support in the bulk loader or an equivalent ndb bulk loader. It may be worth filing one and starring it.

Johnny answered 27/11, 2012 at 2:47 Comment(4)
Thanks I filed an issue on code.google.com/p/appengine-ndb-experiment/issues/detail?id=224Appetizing
Great! I just may take up this fix :)Johnny
@Johnny , currently is bulk uploader available for use with ndb models?Felecia
Any update to this issue? From the issue that Marco created, it doesn't look like there has been any progress :(Fibroin

© 2022 - 2024 — McMap. All rights reserved.