How to delete all entities for NDB Model in Google

2019-03-17 22:16发布

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条回答
Root(大扎)
2楼-- · 2019-03-17 22:56

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)
)
查看更多
登录 后发表回答