问题
I have a ndb model class:
class Game(ndb.Model):
gameID = ndb.IntegerProperty()
gameName = ndb.StringProperty()
Is there any way to quickly just delete all entities thats stored in the database for this class? Something like Game.deletAll()
回答1:
No, but you could easily do this with something like:
from google.appengine.ext import ndb
ndb.delete_multi(
Game.query().fetch(keys_only=True)
)
来源:https://stackoverflow.com/questions/18945109/how-to-delete-all-entities-for-ndb-model-in-google-app-engine-for-python