Copy an entity in Google App Engine datastore in Python without knowing property names at 'compile' time

后端 未结 7 897
庸人自扰
庸人自扰 2020-11-30 01:25

In a Python Google App Engine app I\'m writing, I have an entity stored in the datastore that I need to retrieve, make an exact copy of it (with the exception of the key), a

7条回答
  •  一生所求
    2020-11-30 01:49

    If you're using the NDB you can simply copy with: new_entity.populate(**old_entity.to_dict())

提交回复
热议问题