def model_query(session, model):
    if not issubclass(model, models.BASE):
        raise exception.DatabaseException("model should be sublass of BASE!")

    return session.query(model)
model query.
dataset/ETHPy150Open openstack/compass-core/compass/db/api/utils.py/model_query