我有这个型号
from google.appengine.ext import db
class Question(db.Model):
Qtitle = db.StringProperty()
Q= FirstModel(Qtitle="Who is the most handsome actor?")
Q.put()然后我运行这个GQL查询:
query = db.GqlQuery("SELECT __key__ FROM FirstModel Qtitle='Who is the most handsome actor?' ")
results = query.fetch(10)
for result in results:
print result但是得到了错误!
发布于 2011-09-09 14:50:33
我看到两个错误:
not FirstModel.
Question,并且查询中缺少WHERE子句。发布于 2012-11-08 15:48:24
Try this , or something like that
from google.appengine.ext import db
class Question(db.Model):
Qtitle = db.StringProperty()
Q= Question(Qtitle="Who is the most handsome actor?")
Q.put()
query = db.GqlQuery('SELECT __key__ FROM Question where Qtitle = :qes' , qes='Who is the most handsome actor?').fetch(1)
for result in query
print resulthttps://stackoverflow.com/questions/7357541
复制相似问题