GAE Cloud Datastore: Get most frequently written models

心不动则不痛 提交于 2019-12-06 07:14:04

问题


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()

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.


回答1:


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.



来源:https://stackoverflow.com/questions/50303675/gae-cloud-datastore-get-most-frequently-written-models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!