如果已经提取,数据存储区是否会获取引用实体?

时间:2014-01-18 13:13:21

标签: python google-app-engine google-cloud-datastore

class Author (db.Model)
   name = db.StringProperty()

class Book (db.Model)
   author = db.ReferenceProperty (collection_name="books", indexed=True)
   name = db.StringProperty()

author = Author.get (author_key)
q = Book.all()
q.filter ("author =", author.key())
q.filter ("name =", "BOOK_NAME")
book = q.fetch(1)[0]

book.author.name

最后一个语句(book.author.name)会导致另一个数据存储读取吗?

1 个答案:

答案 0 :(得分:2)

如果你刚刚开始考虑使用ndb,它已经内置了get请求的缓存。