I am using the Google App Engine on localhost. I have 2000 objects of type Book in a data warehouse. I want to delete the first 1900 (key range 1 to 1901). How can I do this from the interactive console? I use ndb as opposed to db
Perhaps there is some kind of range functionality.
For example, I try to do the following, but nothing happens.
from myddb import Book list= Book.gql("WHERE ID < 193") for entity in list: db.delete(entity)
EDIT:
Based on answer from @Lipis works
from myddb import Book from google.appengine.ext import ndb book_keys = Book.query().fetch(keys_only=True) ndb.delete_multi(book_keys)
But it all removes. I need to work with Key aka ID request as
book_keys = Book.query(Article._Key < 1901).fetch(keys_only=True)
source share