I’d like to delete a bunch of objects from the AppEngine datastore within a transaction:
def F():
items_to_delete = []
for item in db.Query().ancestor(...):
if item.aaa ... item.bbb:
items_to_delete.append(item)
db.delete(items_to_delete)
db.run_in_transaction(F)
Is it possible to fetch only a few fields of the items (aaa and bbb)? Will such a fetch have a positive effect on performance?
It’s not possible to fetch only a few fields; i.e. you’ll always be fetching the entire entity with all its fields (or just the entity keys). From the App Engine GQL reference docs:
and