Assuming you was using App Engine Python 2.7 with ndb.PolyModel.
from google.appengine.ext import ndbfrom google.appengine.ext.ndb import polymodelclass Item(polymodel.PolyModel): name = ndb.StringProperty() is_active = ndb.BooleanProperty()class Country(Item): population = ndb.IntegerProperty()
Query using Datastore Python Client Libraries.
from google.cloud import datastorelog = logging.getLogger(__name__)def init_datastore(): return datastore.Client() # return datastore.Client.from_service_account_json('keys/PROJECT_ID-datastore.json')db = init_datastore()query = db.query(kind='Item')query.add_filter('class', '=', 'Country')query.add_filter('is_active', '=', True)items = query.fetch()for _item in items: log.info(f"name={_item['name']}")