我有一个设计问题是 BlobReferenceProperty 基本上是 ReferenceProperty?我应该像 ReferenceProperty 那样进行预取(由 Nick http://blog.notdot.net/2010/01/ReferenceProperty-prefetching-in-App-Engine建议)吗?
目前我有这个设计:
class Entry(db.Model):
creator = db.ReferenceProperty(User, required=True, collection_name='entries')
created_at = db.DateTimeProperty(auto_now_add=True)
# image
image_id = db.StringProperty() # key_name for Image
image_url = db.LinkProperty(indexed=False)
width = db.IntegerProperty(default=0, indexed=False)
height = db.IntegerProperty(default=0, indexed=False)
class Image(db.Model):
created_at = properties.DateTimeProperty(auto_now_add=True)
blob = blobstore.BlobReferenceProperty(required=True)
filename = db.StringProperty(indexed=False)
published = db.BooleanProperty(default=False, indexed=True)
width = db.IntegerProperty(default=0, indexed=False)
height = db.IntegerProperty(default=0, indexed=False)
这会更好还是更糟?我已将 blob 移至 Entry。
class Entry(db.Model):
creator = db.ReferenceProperty(User, required=True, collection_name='entries')
created_at = db.DateTimeProperty(auto_now_add=True)
# image
image_blob = blobstore.BlobReferenceProperty(required=False)
filename = db.StringProperty(indexed=False)
image_id = db.StringProperty()
image_url = db.LinkProperty(indexed=False)
width = db.IntegerProperty(default=0, indexed=False)
height = db.IntegerProperty(default=0, indexed=False)
谢谢。