user1112825
user1112825

Reputation: 1

How to do bulk deletes from Google App Engien Datastore

I need to delete bulk records from datastore, I went through all the previous links but all just talked about fetching the entities from datastore and then deleting them one by one , problem in my case is that I have got around 80K entities and read gets timed out whenever i try to do it using datastore db.delete() method .

Does any one here by any chance know a method more close to SQL to perform a bulk delete ?

Upvotes: 0

Views: 175

Answers (3)

Juan Lara
Juan Lara

Reputation: 6864

You can use Cloud Dataflow to bulk delete entities in Datastore. You can use a GQL query to select the entities to delete:

https://cloud.google.com/datastore/docs/bulk-delete

Upvotes: 0

DataNucleus
DataNucleus

Reputation: 15577

Define what API you're using. JDO? GAE? JPA? You refer to some db.delete, yet tag this as JDO; they are not the same. JDO obviously provides pm.deletePersistentAll(), and if wanting more than that you can make use of Google Mapper API

Upvotes: 0

Igor Artamonov
Igor Artamonov

Reputation: 35936

You can use Task Queue + DB Cursor for deletion.

Task can be executed up to 10 minutes, it's probably enought time to delete all entities. But if it takes longer, you can get current cursor position, and call task itself one more time, with this cursor as paramtere, and start processing from last position.

Upvotes: 3

Related Questions