How to get all kinds of entities from a GAE server?

How can I get all kinds of entities from a GAE server? Is it possible? I want to create a database manager tool for GAE.

+3
source share
2 answers

The best way to do this is to programmatically read data warehouse statistics. See Docs for this in Python or Java . Here is a simple example in Python:

>>> from google.appengine.ext.db import stats
>>> kinds = stats.KindStat.all().fetch(1000)
>>> kind_names = [x.kind_name for x in kinds]
>>> kind_names
[u'A', u'AAFoo', u'AModel', u'ASDBD', u'Abc', u'Accumulator', u'Activity', # ...

You can check it out for yourself in the interactive console .

Data warehouse statistics also provide piles of other details that will be useful when writing a data warehouse management tool. Good luck

0
source

API . :

Query query = new Query(Entities.KIND_METADATA_KIND);
DatastoreService datastoreService = DatastoreServiceFactory.getDatastoreService();

Iterable<Entity> entityIterable = datastoreService.prepare(query).asIterable();

for(Entity entity : entityIterable) {
    System.out.println("Entity kind: " + entity.getKey().getName());
}
+1

Source: https://habr.com/ru/post/1746583/


All Articles