這可能是最愚蠢的問題和我的一樣道歉,但我很困惑如何從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