U aP@sdZddlmZddlmZddlmZddlmZeefZ Gdddej Z e Z Gdd d ej Z Gd d d ejZGd d d ej ZGdddej ZGdddeZGdddeZGdddejZGdddejZGdddejZddZedddZdS) zSQLAlchemy ORM exceptions.)exc)util)MultipleResultsFound) NoResultFoundc@seZdZdZdS)StaleDataErroraaAn 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. * A mapped object with version_id_col was refreshed, and the version number coming back from the database does not match that of the object itself. * A object is detached from its parent object, however the object was previously attached to a different parent identity which was garbage collected, and a decision cannot be made if the new parent was really the most recent "parent". N__name__ __module__ __qualname____doc__r r SC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-nyjtotrf\sqlalchemy\orm\exc.pyrsrc@seZdZdZdS) FlushErrorz0A invalid condition was detected during flush().Nrr r r r r/src@seZdZdZdS) UnmappedErrorz?Base for exceptions that involve expected mappings not present.Nrr r r r r3src@seZdZdZdS)ObjectDereferencedErrorzPAn operation cannot complete due to an object being garbage collected. Nrr r r r r7src@seZdZdZdZdS)DetachedInstanceErrorzSAn attempt to access unloaded attributes on a mapped instance that is detached.Zbhk3N)rr r r coder r r r r>src@s,eZdZdZeddddZddZdS) UnmappedInstanceErrorz;An mapping operation was requested for an unknown instance.sqlalchemy.orm.baseNcCstjj}|srz*|t|tt|}d||f}Wn:tk rptt|}t|trl|dt|7}YnXt ||dS)NzClass %r is mapped, but this instance lacks instrumentation. This occurs when the instance is created before sqlalchemy.orm.mapper(%s) was called.z;; was a class (%s) supplied where an instance was required?) r preloadedorm_baseZ class_mappertype_safe_cls_nameUnmappedClassError_default_unmapped isinstancer__init__)selfobjmsgbasenamer r r rHs$    zUnmappedInstanceError.__init__cCs|jd|jdffSN __class__argsrr r r __reduce___sz UnmappedInstanceError.__reduce__)Nrr r r rpreload_modulerr(r r r r rEs rc@s"eZdZdZdddZddZdS)rz8An mapping operation was requested for an unknown class.NcCs|s t|}t||dS)N)rrr)rclsrr r r rfszUnmappedClassError.__init__cCs|jd|jdffSr"r$r'r r r r(kszUnmappedClassError.__reduce__)N)rr r r rr(r r r r rcs rc@s,eZdZdZeddddZddZdS) ObjectDeletedErroraA 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 :meth:`_query.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. rNcCs,tjj}|sd||}tj||dS)NzDInstance '%s' has been deleted, or its row is otherwise not present.)rrrZ state_strsa_excInvalidRequestErrorr)rstaterr r r r rszObjectDeletedError.__init__cCs|jd|jdffSr"r$r'r r r r(szObjectDeletedError.__reduce__)Nr)r r r r r,os r,c@seZdZdZdS)UnmappedColumnErrorz5Mapping operation was requested on an unknown column.Nrr r r r r0sr0c@seZdZdZddZdS)LoaderStrategyExceptionz2A loader strategy for an attribute does not exist.c CsP|dkr tj|d||fn,tj|dt||t|t|fdS)NzCan't find strategy %s for %szuCan't apply "%s" strategy to property "%s", which is a "%s"; this loader strategy is intended to be used with a "%s".)r-r.rrZclsname_as_plain_name)rZapplied_to_property_typeZrequesting_propertyZ applies_toZactual_strategy_typeZ strategy_keyr r r rs"z LoaderStrategyException.__init__N)rr r r rr r r r r1sr1cCsLzd|j|jf}Wn0tk rFt|dd}|dkrBt|}YnX|S)N.r)joinr rAttributeErrorgetattrrepr)r+Zcls_namer r r rs rrc CsPtjj}z||j}Wntftk r6i}YnXt|}|sLd|SdS)NzClass '%s' is not mapped)rrrZmanager_of_classmappers TypeErrorNO_STATEr)r+r r7r!r r r rs rN)r rr-rrrr4KeyErrorr9ZSQLAlchemyErrorrZConcurrentModificationErrorrr.rrrrrr,r0r1rr*rr r r r s&     $