本地主机上的Google App Engine GQL查询 [英] Google App Engine GQL query on localhost

查看:218
本文介绍了本地主机上的Google App Engine GQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Google App Engine上开发应用程序(Windows上的SDK版本为1.7.0),我需要经常进行测试,此测试涉及数据存储上的大量GQL查询。



您可以在App Engine的在线管理界面的浏览器中运行GQL查询: b
$ b



但是这似乎在localhost上的SDK管理控制台上不可行。没有这样的选项:





每次编写一个python脚本来查询短时间任务的结果并不方便。另外,如果您在在线管理界面上执行此操作,则可以立即在下面的一个很好的表格中看到查询结果。如果您想通过Python脚本在浏览器窗口中查看所有查询结果,则必须编写更多代码,基本上试图重写Google在他们的服务器管理界面上已经做得很好。



因此,我不得不在部署后在App Engine管理界面的浏览器上执行此操作,这会不断增加我允许的操作数,直到我很快达到我的免费每日配额限制。 / p>

所以没有办法在我的本地主机上运行GQL查询(非编程方式,在浏览器上)?

解决方案

您拥有交互式控制台,您可以在那里运行GQL查询。

例如,您可以在交互式控制台中运行以下代码:

  from google.appengine.ext import db 
q = db.GqlQuery(SELECT * FROM Song WHERE composer ='Lennon,John ')


I am developing an app on Google App Engine (SDK version 1.7.0 on Windows) that I need to test often, and this testing involves a lot of GQL queries on the datastore.

You can run GQL queries at the browser in App Engine's admin interface online:

But this seems to be not possible on the SDK admin console on localhost. There is no such option:

So it seems I can run GQL queries only through python scripts on my localhost.

It's not convenient to write a python script every time to query the results for short tasks here and there. Also, if you do it at the online admin interface, you can see the query results immediately in a nice table below. If you want to visualize all your query results in a browser window through a python script you'd have to write a lot more code, basically trying to rewrite what Google has already done very well at their server admin interface.

So I am stuck having to do this at the browser on the App Engine admin interface after deployment, which keeps adding to my allowed operations count until I have soon hit my free daily quota limit.

So isn't there any way to run GQL queries (non-programmatically, on a browser) on my localhost?

解决方案

You have the Interactive Console for that, you get run GQL query there.
For example you can run following code in the Interactive Console:

from google.appengine.ext import db
q = db.GqlQuery("SELECT * FROM Song WHERE composer = 'Lennon, John'")

这篇关于本地主机上的Google App Engine GQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆