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

我只是一个虾纸丫 提交于 2020-01-15 04:45:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/22103245/updating-an-entitys-property-without-retrieving-the-entity-from-the-ndb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!