kasavbere
kasavbere

Reputation: 6003

Query to update a field in appengine datastore entities

I have a ndb.Model called Article. It has a number of entities, say 1000. The model has title, author, date, content. Say all my titles contain the phrase by Kasav Bere somewhere in the title string.

Is there a way to run a query on the datastore that would remove all occurences of by Kasav Bere. I keep searching, but no luck yet.

Upvotes: 0

Views: 107

Answers (1)

lucemia
lucemia

Reputation: 6627

There is no such query.

You can either 1) fetch all entities, remove all "by Kasav Bere", and put them back. Or 2) use mapreduce https://developers.google.com/appengine/docs/python/dataprocessing/overview

For 1000 entities, I would recommend just fetch all entities and put them back.

You can easily do this kind of task with remote shell https://developers.google.com/appengine/articles/remote_api

Upvotes: 1

Related Questions