这可能是最愚蠢的问题和我的一样道歉,但我很困惑如何从GAE NDB属性(类型BlobKeyProperty)删除值
我有以下实体:
class Profile(ndb.Model):
name = ndb.StringProperty()
identifier = ndb.StringProperty()
pic = ndb.BlobKeyProperty() # stores the key to the profile picture blob
我想要删除上述实体的“pic”属性值,以便它看起来应该像“pic”从未分配任何值一样新鲜。我不打算删除整个实体。是下面的方法正确:
qry = Profile.query(Profile.identifier==identifier)
result_record_list = qry.fetch()
if result_record_list:
result_record_list[0].pic.delete() # or result_record_list[0].pic = none # or undefined or null
我删除此Blob键指实际的BLOB分别
感谢omair_77您的回复 – gsinha