Reputation: 55
I am trying to delete a particular row in the datastore google app engine. The list of entries are displayed in the web page and the user clicks a button to delete a particular entry, this should reflect the datastore. From the jinja template i'm passing the ID of the entry when the delete-button is clicked by user. The below python code should handle the delete action in the datastore.
def post(self,id):
q = db.GqlQuery('SELECT * FROM Input WHERE ID=:1', id)
for msg in q:
db.delete(msg) # msg.delete() #I tried these both stil not working
It is not showing any error message to me and shows HTTP 200 message. But when I check the datastore the enrty isn't deleted :( Please help me to fix this.
Upvotes: 0
Views: 88
Reputation: 24966
I'm guessing that one of two things are happening: One is that id
isn't what you expect, and the query isn't returning entities (some logging will suss that out). The other is that you're seeing the effects of "eventual consistency", which is described in some detail here. A test for that is whether you still see entity that after some time has elapsed. The fix for the second problem is to deleted entities from within a transaction.
Upvotes: 1