how to cleanly remove ndb properties

后端 未结 1 659
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-13 11:17

in my app i need to remove a few of my models properties.
i checked out this link but the first issue is that the properties are on a polymodel and there is

相关标签:
1条回答
  • 2020-12-13 11:46

    If you want to update all your entities the recommended approach is a map/reduce job that reads and rewrites all entities; however it may not be worth it, depending on how much data you have -- the map/reduce isn't free either.

    Also be sure you test the map/reduce job on a small subset of the data. It is remarkably subtle to truly remove a property from an entity, even if it's not in the model class any more! The best approach may be:

    if 'propname' in ent._properties:
      del ent._properties['propname']
      ent.put()
    
    0 讨论(0)
提交回复
热议问题