I created one table in Google App Engine .I stored and retrieved data from Google App Engine. But i don't know how to delete data from Google App Engine datastore.
An application can delete an entity from the datastore using a model instance or a Key. The model instance's delete() method deletes the corresponding entity from the datastore. The delete() function takes a Key or list of Keys and deletes the entity (or entities) from the datastore:
q = db.GqlQuery("SELECT * FROM Message WHERE msg_date < :1", earliest_date)
results = q.fetch(10)
for result in results:
result.delete()
# or...
q = db.GqlQuery("SELECT __key__ FROM Message WHERE msg_date < :1", earliest_date)
results = q.fetch(10)
db.delete(results)
Source and further reading:
If you want to delete all the data in your datastore, you may want to check the following Stack Overflow post:
You need to find the entity then you need delete it.
So in python it would be
q = db.GqlQuery("SELECT __key__ FROM Message WHERE create_date < :1", earliest_date)
results = q.get()
db.delete(results)
or in Java it would be
pm.deletePersistent(results);
URLS from app engine are
http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html#Deleting_an_Object http://code.google.com/appengine/docs/python/datastore/creatinggettinganddeletingdata.html#Deleting_an_Entity