pythongoogle-app-enginegoogle-cloud-datastoregoogle-cloud-pythongcloud-python

Programmatically get Google Datastore record count and used storage


I need to get Google Datastore usage statistics - storage usage, and record count for my application.

At the moment I only can count fetch all items and count them. But I have no idea how I can get storage amount used.

Is there any reports API I can use? (Like Google Apps report api)

PS. I use gcloud-python library to access Datastore.

Edited:

Thank you Andrei - Angels Like Reb

That's how I did it:

from gcloud import datastore
stat = list(datastore.Query('__Stat_Total__').fetch())[0]
print "bytes", stat['bytes']
print "count", stat['count']

Solution

  • You can use statistics queries.