How to get the list of all NDB model names in GAE Python ?
All NDB models are Python classes which inherit from ndb.Model
. I thought we could use this info to fetch the names of all models.
class BK (ndb.Model):
property_1 = ..
I tried below ( borrowed ) code but in vain :
ATTEMPT 1
logging.info ( [ cls.__name__ for cls in globals()['ndb.Model'].__subclasses__() ] )
It results in error :
KeyError: 'ndb.Model'
ATTEMPT 2
logging.info ( [ cls.__name__ for cls in globals()['Model'].__subclasses__() ] )
It results in error :
KeyError: 'Model'