def get_db_object(session, table, exception_when_missing=True, **kwargs):
    if not session:
        raise exception.DatabaseException('session param is None')
    with session.begin(subtransactions=True):
        logging.debug(
            'session %s get db object %s from table %s',
            id(session), kwargs, table.__name__)
        db_object = model_filter(
            model_query(session, table), table, **kwargs
        ).first()
        logging.debug(
            'session %s got db object %s', id(session), db_object
        )
        if db_object:
            return db_object

        if not exception_when_missing:
            return None

        raise exception.RecordNotExists(
            'Cannot find the record in table %s: %s' % (
                table.__name__, kwargs
            )
        )
Trains the classifier with the given document of the given type (i.e., class).
dataset/ETHPy150Open openstack/compass-core/compass/db/api/utils.py/get_db_object--crossover with--dataset/ETHPy150Open clips/pattern/pattern/vector/__init__.py/Classifier.train