我有这个模型
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
但得到了错误!
答案 0 :(得分:1)
我看到两个错误:
Question
,而非FirstModel
。WHERE
子句。答案 1 :(得分:1)
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 result