dreamwalker
dreamwalker

Reputation: 1743

updating an entity's property without retrieving the entity from the NDB

I would like to update a property of an entity that has a lot of properties.

If I understand it correctly, whenever I retrieve the entity from the datastore by

entity = key_of_entity.get()

to later update it's property

entity.some_property += 1
entity.put()

I am charged for read of every property of that entity? Since this entity has quite a few properties, such reading over and over again can be quite expensive. Is there any way to update an entity's property without having to do a read on it first?

Upvotes: 2

Views: 425

Answers (1)

Andrei Volgin
Andrei Volgin

Reputation: 41099

The only solution is to split this entity into two parts: rarely updated and frequently updated. You can make them totally independent (with an id of one entity as a property in another entity), or you can make one of them a parent and the other one a child.

Upvotes: 5

Related Questions