Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 在google appengine中选择_Key u_Google App Engine_Gql - Fatal编程技术网

Google app engine 在google appengine中选择_Key u

Google app engine 在google appengine中选择_Key u,google-app-engine,gql,Google App Engine,Gql,我有这个型号 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

我有这个型号

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
但是有错误

我看到两个错误:

  • 模型类名是
    Question
    ,而不是
    FirstModel
  • 查询中缺少
    WHERE
    子句
  • “有错误”-什么错误?给我们看看你的跟踪,别让我们猜。
    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