python-3.x - gcp:datastore - 使用 Python API 获取总体状态 __Stat_Total__
问题描述
我想获取仪表板应用程序的整体数据存储统计信息。我浏览了文档,没有关于如何使用数据存储获取统计信息的教程。以某种方式获取状态详细信息有SELECT * FROM __Stat_Total__
显示的 GQL 查询
builtin_index_bytes,
builtin_index_count,
bytes,
composite_index_bytes,
composite_index_count,
count,
entity_bytes,
timestamp
。
我想通过 Python API 客户端显示所有这些细节。
我尝试了一些没有成功的例子。
def get_summary_statistics(self):
#[START getting the Summary Statistics]
stats = self.client.query(kind= self.kind_name)
overall_stats = stats.__Stat_Total__ ()
return overall_stats
如何获取所有数据存储统计信息?
解决方案
Cloud Datastore NDB 管理文档包含有关和其他统计实体的一些信息,__Stat_Total__
以及一个查询 Datastore 统计信息的小示例脚本:
from google.appengine.ext.ndb import stats
global_stat = stats.GlobalStat.query().get()
print 'Total bytes stored: %d' % global_stat.bytes
print 'Total entities stored: %d' % global_stat.count
推荐阅读
- azure-cosmosdb - 如何为 CosmosDB 文档中的数组元素设置别名?
- python - Altair条形图具有可变宽度的条形?
- android - 如何在谷歌地图上显示单个地址的子地址点
- indexing - 调查慢查询和索引
- php - WordPress 中 file_get_contents 函数的替代
- sql - PostgreSQL 索引表性能突然下降
- linux - 有没有办法通过 redis-cli 设置日志文件但不编辑 redis.config 文件?
- android - 拆分安装 API 不可用。安装动态功能 Android Studio 时出现错误代码 - 5
- teradata - 如何仅更新 Teradata 日期列中的年份
- db2 - 设置 DB2 和 IBM Data Studio 的无尽麻烦