App Engine Datastore Viewer,如何使用GQL显示记录数? [英] App Engine Datastore Viewer, how to show count of records using GQL?

查看:193
本文介绍了App Engine Datastore Viewer,如何使用GQL显示记录数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会认为对于类似SQL的人来说,这很容易!我想要的是GQL相当于:

 从foo选择count(*); 

并找回类似的答案:

  1972记录。 

我想在基于Web的DataStore查看器中的命令行 。 (你知道,一次只显示20个,让我看到下一个20)

无论如何 - 我敢肯定,这简直就是脑死亡,我似乎无法找到正确的语法。感谢!

谢谢!

声明在其他 问题,它看起来像没有 count GQL中的聚合函数。 GQL Reference 也没有说有这种能力要做到这一点,虽然它没有明确说明它是不可能的。



在开发控制台(本地运行你的应用程序)中,它看起来就像点击List Entities 按钮将显示一个特定类型的所有实体的列表,并且您可以看到(某些编号)的结果1-10以在您的开发环境中获得总计数。



在生产中,您可以使用数据存储统计选项卡(数据存储查看器下面的链接),选择显示统计数据:(实体类型),然后它会显示实体的总数这不是最新的数据视图(更新至少每天一次)。

由于您无法通过浏览器在生产环境中运行任意代码,因此我不要以为在查询中使用 .count()> wo uld帮助,但如果您使用远程API ,则 .count()方法不再限制在2010年8月的1000个条目,因此您应该可以运行 print MyEntity.all()。count()并得到你想要的结果。


I would think this would be easy for an SQL-alike! What I want is the GQL equivalent of:

select count(*) from foo;

and to get back an answer something similar to:

1972 records.

And I want to do this in GQL from the "command line" in the web-based DataStore viewer. (You know, the one that shows 20 at a time and lets me see "next 20")

Anyway -- I'm sure it's brain-dead easy, I just can't seem to find the correct syntax. Any help would be appreciated.

Thanks!

解决方案

As it's stated in other questions, it looks like there is no count aggregate function in GQL. The GQL Reference also doesn't say there is the ability to do this, though it doesn't explicitly say that it's not possible.

In the development console (running your application locally) it looks like just clicking the "List Entities" button will show you a list of all entities of a certain type, and you can see "Results 1-10 of (some number)" to get a total count in your development environment.

In production you can use the "Datastore Statistics" tab (the link right underneath the Datastore Viewer), choose "Display Statistics for: (your entity type)" and it will show you the total number of entities, however this is not the freshest view of the data (updated "at least once per day").

Since you can't run arbitrary code in production via the browser, I don't think saying "use .count() on a query" would help, but if you're using the Remote API, the .count() method is no longer capped at 1000 entries as of August, 2010, so you should be able to run print MyEntity.all().count() and get the result you want.

这篇关于App Engine Datastore Viewer,如何使用GQL显示记录数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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