I am going to delete entries from my python application engine server as follows:
try: while True: q = db.GqlQuery("SELECT __key__ FROM SampleData") assert q.count() db.delete(q.fetch(400)) time.sleep(0.2) except Exception, e: self.response.out.write(repr(e)+'\n') pass try: while True: q = db.GqlQuery("SELECT __key__ FROM UserData") assert q.count() db.delete(q.fetch(400)) time.sleep(0.2) except Exception, e: self.response.out.write(repr(e)+'\n') pass
.. but it just seems ugly, and I continue to suspect that it is not entirely reliable. Is there a better way to do this by deleting records of a certain number of types instead of making one of each of them during loops?
Update. I have one limitation: I run this periodically with a cron job, so I donโt want to do this manually (for example, through the admin console).
source share