I try to get all entities from a namespace in order to delete them in a later step.
Im using appengine
together with datastore
and ndb
lib using python2.7
I have a simple query to get all entities:
def get_entities(namespace_id):
return [entity for entity in ndb.Query(namespace=namespace_id).fetch()]
Also modified it to avoid the dunder kinds/entities Datastore Statistics in legacy bundled services:
def get_entities(namespace_id):
return [entity for entity in ndb.Query(namespace=namespace_id).fetch() if not entity.key.id_or_name.startswith('__')]
While running locally using datastore emulator works just fine. But I get this error when deployed in the cloud:
KindError: No model class found for kind '__Stat_Ns_Kind_IsRootEntity__'. Did you forget to import it?
I found this post Internal Kinds Returned When Retrieving All Entities Belonging to a Particular Namespace but not a clear answer.
If you have another way to get all the entities fro a specific namespace will be welcome!!