Google App Engine中的数据存储模型中的行数是如何计算的? [英] How does one get a count of rows in a Datastore model in Google App Engine?
本文介绍了Google App Engine中的数据存储模型中的行数是如何计算的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要获得App Engine上特定模型的记录数。如何做到这一点?
我批量上传了超过4000条记录,但modelname.count()只显示1000条。
解决方案
您应该使用数据存储统计:
查询查询=新查询(__ Stat_Kind__);
query.addFilter(kind_name,FilterOperator.EQUAL,kind);
Entity entityStat = datastore.prepare(query).asSingleEntity();
Long totalEntities =(Long)entityStat.getProperty(count);
请注意,上述内容在开发数据存储区时不起作用,但可用于生产(发布时) 。
我发现这是一个旧帖子,但我添加了一个答案,以利于其他人搜索相同的内容。
I need to get a count of records for a particular model on App Engine. How does one do it?
I bulk uploaded more than 4000 records but modelname.count() only shows me 1000.
解决方案
You should use Datastore Statistics:
Query query = new Query("__Stat_Kind__");
query.addFilter("kind_name", FilterOperator.EQUAL, kind);
Entity entityStat = datastore.prepare(query).asSingleEntity();
Long totalEntities = (Long) entityStat.getProperty("count");
Please note that the above does not work on the development Datastore but it works in production (when published).
I see that this is an old post, but I'm adding an answer in benefit of others searching for the same thing.
这篇关于Google App Engine中的数据存储模型中的行数是如何计算的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文