小编Pwn*_*fex的帖子

Google App Engine:在引用属性上调用.key().id()会触发该实体的获取吗?

如果我有一个带引用属性的对象,那么在引用属性上调用.key()或.key().id()方法会导致从数据存储中检索它吗?或者我可以从没有触发请求的那些人那里获得价值吗?

class MyObject(db.Model):
    reference = db.ReferenceProperty()

myObj = MyObject( reference = myOtherObject )
myObj.put()

# Will this retrieve the key without doing a get for the object?
temp1 = myObj.reference.key()

# What about this?
temp2 = myObj.reference.key().id()
Run Code Online (Sandbox Code Playgroud)

google-app-engine

3
推荐指数
1
解决办法
1129
查看次数

标签 统计

google-app-engine ×1