18

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 Answer 1

40

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)
)
2
  • 1
    your query is a list of keys: ndb.delete_multi(query) Commented Sep 22, 2013 at 22:27
  • 3
    You'll be a little bit better if you use iter instead of fetch
    – Uri London
    Commented Nov 5, 2013 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.