ORM Exceptions

    attribute sqlalchemy.orm.exc..sqlalchemy.orm.exc.ConcurrentModificationError

    alias of

    exception sqlalchemy.orm.exc.DetachedInstanceError

    An attempt to access unloaded attributes on a mapped instance that is detached.

    Class signature

    class sqlalchemy.orm.exc.DetachedInstanceError ()

    exception sqlalchemy.orm.exc.FlushError

    A invalid condition was detected during flush().

    Class signature

    class sqlalchemy.orm.exc.FlushError ()

    exception sqlalchemy.orm.exc.LoaderStrategyException

    A loader strategy for an attribute does not exist.

    Class signature

    sqlalchemy.orm.exc.NO_STATE = (<class ‘AttributeError’>, <class ‘KeyError’>)

    Exception types that may be raised by instrumentation implementations.

    exception sqlalchemy.orm.exc.ObjectDeletedError

    A refresh operation failed to retrieve the database row corresponding to an object’s known primary key identity.

    A refresh operation proceeds when an expired attribute is accessed on an object, or when Query.get() is used to retrieve an object which is, upon retrieval, detected as expired. A SELECT is emitted for the target row based on primary key; if no row is returned, this exception is raised.

    The true meaning of this exception is simply that no row exists for the primary key identifier associated with a persistent object. The row may have been deleted, or in some cases the primary key updated to a new value, outside of the ORM’s management of the target object.

    Class signature

    class (sqlalchemy.exc.InvalidRequestError)

    exception sqlalchemy.orm.exc.ObjectDereferencedError

    An operation cannot complete due to an object being garbage collected.

    Class signature

    class (sqlalchemy.exc.SQLAlchemyError)

    exception sqlalchemy.orm.exc.StaleDataError

    An operation encountered database state that is unaccounted for.

    Conditions which cause this to happen include:

    • A flush may have attempted to update or delete rows and an unexpected number of rows were matched during the UPDATE or DELETE statement. Note that when version_id_col is used, rows in UPDATE or DELETE statements are also matched against the current known version identifier.

    Class signature

    class (sqlalchemy.exc.SQLAlchemyError)

    exception sqlalchemy.orm.exc.UnmappedClassError

    An mapping operation was requested for an unknown class.

    Class signature

    class (sqlalchemy.orm.exc.UnmappedError)

    exception sqlalchemy.orm.exc.UnmappedColumnError

    Mapping operation was requested on an unknown column.

    Class signature

    class (sqlalchemy.exc.InvalidRequestError)

    exception sqlalchemy.orm.exc.UnmappedError

    Base for exceptions that involve expected mappings not present.

    Class signature

    class (sqlalchemy.exc.InvalidRequestError)

    exception sqlalchemy.orm.exc.UnmappedInstanceError

    An mapping operation was requested for an unknown instance.

    Class signature

    • method __init__(obj: object, msg: Optional[str] = None)