Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete entity from google App engine Datastore?

I created an entity in the Google App Engine datastore.

How can I remove this entity?

like image 266
user246160 Avatar asked Mar 15 '10 05:03

user246160


2 Answers

You haven't specified which API you're using.

In Python it's like so:

db.delete(modelId)

In Java it should be like (I haven't tested this):

PersistenceManager pm = PMF.get().getPersistenceManager();

MyModel entity = pm.getObjectById(MyModel.class, modelId);
pm.deletePersistent(entity);

pm.close();
like image 164
Brian McKenna Avatar answered Sep 25 '22 12:09

Brian McKenna


In python if you know the key it really simple:

db.delete(key)
like image 23
Ilian Iliev Avatar answered Sep 24 '22 12:09

Ilian Iliev