GAE Cloud Datastore:获取最常用的模型 [英] GAE Cloud Datastore: Get most frequently written models

查看:44
本文介绍了GAE Cloud Datastore:获取最常用的模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试以最常用的模型降序获取模型列表. 这是我到目前为止所尝试的.此 client 查询集提供了模型及其属性/属性的详细信息,以及与模型相关的详细信息: 实体计数,内置索引计数,内置索引大小,数据大小,复合索引大小,复合索引计数,总大小.但是,没有关于写入频率和/或有关数据库put()或save()操作的任何分析的详细信息.

I am trying to get the list of models in decreasing order of most frequently written models. This is what I have tried so far.This client query set gives the details of models and their attributes/properties, with these model related details : Entity count, Built-in index count, Built-in index size, Data size, Composite index size, Composite index count, Total Size. But there is no detail about write frequencies and/or any analytics about database put() or save() operations.

from google.cloud import datastore
import math

def run_quickstart():
    # [START datastore_quickstart]
    # Imports the Google Cloud client library

    client = datastore.Client()
    query = client.query(kind='__Stat_Kind__')
    detail_list = []
    items = list(query.fetch())
    for results in items:
        results = results.viewitems()
        detail_list.append(results)

    print detail_list

if __name__ == '__main__':
    run_quickstart()

GAE Cloud Datastore是否提供有关数据库写入频率的任何此类信息?我的主要目标是通过最多的写入来获得最繁忙的模型/数据库表.

Does GAE Cloud Datastore provide any such information of database write frequencies? My main objective is to get most busy model/ database table with most writes.

推荐答案

否,GAE不记录实体的写入频率.添加一个属性来记录实体放置的次数并在每次写入时增加它,即可轻松实现自己.

No, GAE does not record write frequency of entities. It is easy enough to implement yourself by adding a property to record the number of times an entity has been put and increment it on each write.

这篇关于GAE Cloud Datastore:获取最常用的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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