【发布时间】:2014-09-03 06:09:00
【问题描述】:
在谷歌应用引擎中,是否可以查询数据库以仅获取某些列?
例如,我有一个模型定义如下:
class userData(ndb.Model):
id = ndb.StringProperty()
name = ndb.StringProperty()
emailAddress = ndb.StringProperty()
我一般查询db如下:
userData.query().filter(ndb.GenericProperty('id') == "requiredId").fetch()
但这给了我包含 id、name 和 email 的结果。
现在我只想获得 id 和 name,而不是 emailAddress。我该怎么做?
谢谢!
【问题讨论】:
标签: python google-app-engine app-engine-ndb google-cloud-datastore