Я понимаю, что вся информация о моем блобе не удаляется должным образом, если я пытаюсь удалить ее через BlobInfo. (Я хочу выполнить перезапись BLOB-объектов) Мой код выглядит следующим образом:
from google.appengine.ext import db
from google.appengine.ext import blobstore
class Human(db.Model):
email = db.StringProperty(required=True)
date = db.DateTimeProperty(auto_now=True)
checksum = db.IntegerProperty(required=True)
version = db.IntegerProperty(required=True)
content = blobstore.BlobReferenceProperty(required=True)
def upload(email, checksum, version, content):
# Create the file
file_name = files.blobstore.create(mime_type='application/octet-stream', _blobinfo_uploaded_filename=email)
# Open the file and write to it
with files.open(file_name, 'a') as f:
f.write(content)
# Finalize the file. Do this before attempting to read it.
files.finalize(file_name)
# Get the file's blob key
blob_key = files.blobstore.get_blob_key(file_name)
human = model.Human(key_name=email, email=email, checksum=checksum, version=version, content=blob_key)
# Remove previous blob referenced by this human.
query = model.Human.all()
query.filter('email =', email)
# q.content is blobstore.BlobReferenceProperty(required=True)
for q in query:
q.content.delete()
human.put()
Тем не менее, после того, как я несколько раз написал блоб, основываясь на одном и том же человеке, вот как выглядит моя база данных. Я загрузил в 3 раза. Я ожидаю увидеть только один ряд. Тем не менее, я понимаю, что есть 3 строки в __BlobFileIndex__
. Human
и __BlobInfo__
просто отлично выглядят.
![enter image description here](https://i.stack.imgur.com/vbBu1.png)
Как я могу выполнить правильное удаление на основе BlobInfo?