L i]VUdZddlmZddlZddlmZddlmZddlmZddlmZddlmZdd lm Z dd lm Z d d l m Z d d l m Zejrd dlmZd dlmZd dlmZd dlmZd dlmZejrded<ndZGddZGddeeZGddeZGddeZGddeZGdd eZ Gd!d"eZ!Gd#d$eZ"Gd%d&eZ#Gd'd(eZ$Gd)d*eZ%Gd+d,e%Z&Gd-d.eZ'Gd/d0eZ(Gd1d2e(Z)Gd3d4eZ*Gd5d6eZ+Gd7d8e+Z,Gd9d:e+Z-Gd;de+Z/Gd?d@e+e0Z1GdAdBe+Z2GdCdDe+Z3GdEdFe+Z4GdGdHe+Z5GdIdJe+Z6GdKdLe4Z7GdMdNe4Z8GdOdPe+Z9GdQdRe+Z:GdSdTe+Z;GdUdVZ<GdWdXeZ=GdYdZe=Z>Gd[d\e>Z?Gd]d^e>Z@Gd_d`e@ZAGdadbe@ZBGdcdde@ZCGdedfe@ZDGdgdhe@ZEGdidje@ZFGdkdleGZHGdmdneeIZJGdodpeJZKGdqdreKZLGdsdteKZMGdudveNZOGdwdxeePZQy)yzExceptions used with SQLAlchemy. The base exception class is :exc:`.SQLAlchemyError`. Exceptions which are raised as a result of DBAPI exceptions are all subclasses of :exc:`.DBAPIError`. ) annotationsN)Any)List)Optional)overload)Tuple)Type)Union)compat) preloaded)_AnyExecuteParams)Dialect)Compiled) TypeCompiler) ClauseElementstr_version_tokencLeZdZUdZdZded<d fd ZdZd dZd fd Z xZ S) HasDescriptionCodezDhelper which adds 'code' as an attribute and '_code_str' as a methodN Optional[str]codecZ|jdd}|||_t| |i|y)Nr)poprsuper__init__)selfargkwr __class__s T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sqlalchemy/exc.pyrzHasDescriptionCode.__init__0s2vvfd#  DI #$$errorcd|jsyd|jdtd|jdS)Nz(Background on this z at: https://sqlalche.me/e//))r _what_are_werrs r! _code_strzHasDescriptionCode._code_str8s>yy't'8'8&9:))7(8$))AG r"cft|}|jr|d|j}|SN )r__str__rr*)rmessager s r!r.zHasDescriptionCode.__str__As,'/# 99!($..*:;Gr")rrrrreturnr) __name__ __module__ __qualname____doc__r__annotations__rr(r*r. __classcell__r s@r!rr+s+ND-% Lr"rc(eZdZdZddZddZddZy)SQLAlchemyErrorzGeneric error class.ct|jdk(rD|jd}t|trt j |d}|St |}|St |jS)Nr rzutf-8)lenargs isinstancebytesr decode_backslashreplacer)rarg_texttexts r!_messagezSQLAlchemyError._messageKsd tyy>Q yy|H(E*55hHK8}K tyy> !r"ch|j}|jr|d|j}|Sr,)rCrr*)rr/s r! _sql_messagezSQLAlchemyError._sql_messagejs*--/ 99!($..*:;Gr"c"|jSN)rEr)s r!r.zSQLAlchemyError.__str__rs  ""r"Nr0)r2r3r4r5rCrEr.r"r!r:r:Hs">#r"r:ceZdZdZy) ArgumentErrorzRaised when an invalid or conflicting function argument is supplied. This error generally corresponds to construction time state errors. Nr2r3r4r5rHr"r!rJrJvr"rJceZdZdZy)DuplicateColumnErrorza Column is being added to a Table that would replace another Column, without appropriate parameters to allow this in place. .. versionadded:: 2.0.0b4 NrKrHr"r!rNrN~r"rNc,eZdZdZdfd ZddZxZS)ObjectNotExecutableErrorzVRaised when an object is passed to .execute() that can't be executed as SQL. c8t|d|z||_y)NzNot an executable object: %r)rrtarget)rrSr s r!rz!ObjectNotExecutableError.__init__s 7&@A r"c4|j|jffSrG)r rSr)s r! __reduce__z#ObjectNotExecutableError.__reduce__s~~ ~--r")rSrr1zUnion[str, Tuple[Any, ...]])r2r3r4r5rrUr7r8s@r!rQrQs .r"rQceZdZdZy)NoSuchModuleErrorzpRaised when a dynamically-loaded module (usually a database dialect) of a particular name cannot be located.NrKrHr"r!rXrXs/r"rXceZdZdZy)NoForeignKeysErrorzURaised when no foreign keys can be located between two selectables during a join.NrKrHr"r!rZrZsr"rZceZdZdZy)AmbiguousForeignKeysErrorzhRaised when more than one foreign key matching can be located between two selectables during a join.NrKrHr"r!r\r\s.r"r\ceZdZdZy)ConstraintColumnNotFoundErrorzraised when a constraint refers to a string column name that is not present in the table being constrained. .. versionadded:: 2.0 NrKrHr"r!r^r^rOr"r^c8eZdZdZ d ddZddZy)CircularDependencyErrora Raised by topological sorts when a circular dependency is detected. There are two scenarios where this error occurs: * In a Session flush operation, if two objects are mutually dependent on each other, they can not be inserted or deleted via INSERT or DELETE statements alone; an UPDATE will be needed to post-associate or pre-deassociate one of the foreign key constrained values. The ``post_update`` flag described at :ref:`post_update` can resolve this cycle. * In a :attr:`_schema.MetaData.sorted_tables` operation, two :class:`_schema.ForeignKey` or :class:`_schema.ForeignKeyConstraint` objects mutually refer to each other. Apply the ``use_alter=True`` flag to one or both, see :ref:`use_alter`. Nc||ddjd|Dzz }n|}tj|||||_||_y)Nz (%s)z, c32K|]}t|ywrG)repr).0ss r! z3CircularDependencyError.__init__..s*Cq47*Csr)joinr:rcyclesedges)rr/rirjmsgrs r!rz CircularDependencyError.__init__sO ; w*CF*C!CC CGG  wT :  r"c|jd|j|j|jdf|jd|jifSifS)Nrr)r rirjr=rr)s r!rUz"CircularDependencyError.__reduce__sT NN 4;; DIIaL 9#'99#8VTYY   ?A  r")NN) r/rrirrjrrkrrrrVr2r3r4r5rrUrHr"r!r`r`sI.""        r"r`ceZdZdZy) CompileErrorz2Raised when an error occurs during SQL compilationNrKrHr"r!roroseZdZdZdZ d dfd ZddZxZS)UnsupportedCompilationErrorzRaised when an operation is not supported by the given compiler. .. seealso:: :ref:`faq_sql_expression_string` :ref:`error_l7de` l7declt|d|d||rd|znd||_||_||_y)Nz Compiler z can't render element of type z: %sr%)rrcompiler element_typer/)rrtrur/r s r!rz$UnsupportedCompilationError.__init__sC 7v'7'J L ! ( r"c`|j|j|j|jffSrG)r rtrur/r)s r!rUz&UnsupportedCompilationError.__reduce__s&~~ t/@/@$,,OOOr"rG)rtzUnion[Compiled, TypeCompiler]ruzType[ClauseElement]r/rrV)r2r3r4r5rrrUr7r8s@r!rqrqs; D "& / *  Pr"rqceZdZdZy)IdentifierErrorz;Raised when a schema name is beyond the max character limitNrKrHr"r!rxrxsEr"rxc eZdZUdZdZded<y)DisconnectionErroraA disconnect is detected on a raw DB-API connection. This error is raised and consumed internally by a connection pool. It can be raised by the :meth:`_events.PoolEvents.checkout` event so that the host pool forces a retry; the exception will be caught three times in a row before the pool gives up and raises :class:`~sqlalchemy.exc.InvalidRequestError` regarding the connection attempt. Fboolinvalidate_poolNr2r3r4r5r|r6rHr"r!rzrzs "OT!r"rzc eZdZUdZdZded<y)InvalidatePoolErroraRaised when the connection pool should invalidate all stale connections. A subclass of :class:`_exc.DisconnectionError` that indicates that the disconnect situation encountered on the connection probably means the entire pool should be invalidated, as the database has been restarted. This exception will be handled otherwise the same way as :class:`_exc.DisconnectionError`, allowing three attempts to reconnect before giving up. .. versionadded:: 1.2 Tr{r|Nr}rHr"r!rr s !OT r"rceZdZdZy) TimeoutErrorz@Raised when a connection pool times out on getting a connection.NrKrHr"r!rrsJr"rceZdZdZy)InvalidRequestErrorzvSQLAlchemy was asked to do something it can't do. This error generally corresponds to runtime state errors. NrKrHr"r!rr#rLr"rceZdZdZy)IllegalStateChangeErrorzrAn object that tracks state encountered an illegal state change of some kind. .. versionadded:: 2.0 NrKrHr"r!rr+rOr"rceZdZdZy)NoInspectionAvailablezaA subject passed to :func:`sqlalchemy.inspection.inspect` produced no context for inspection.NrKrHr"r!rr4s"r"rceZdZdZy)PendingRollbackErrorzlA transaction has failed and needs to be rolled back before continuing. .. versionadded:: 1.4 NrKrHr"r!rr9rOr"rceZdZdZy)ResourceClosedErrorzcAn operation was requested from a connection, cursor, or other object that's in a closed state.NrKrHr"r!rrBs(r"rceZdZdZy)NoSuchColumnErrorz1A nonexistent column is requested from a ``Row``.NrKrHr"r!rrGs;r"rceZdZdZy) NoResultFoundzA database result was required but none was found. .. versionchanged:: 1.4 This exception is now part of the ``sqlalchemy.exc`` module in Core, moved from the ORM. The symbol remains importable from ``sqlalchemy.orm.exc``. NrKrHr"r!rrKsr"rceZdZdZy)MultipleResultsFounda A single database result was required but more than one were found. .. versionchanged:: 1.4 This exception is now part of the ``sqlalchemy.exc`` module in Core, moved from the ORM. The symbol remains importable from ``sqlalchemy.orm.exc``. NrKrHr"r!rrWsr"rceZdZUdZded<y)NoReferenceErrorzDRaised by ``ForeignKey`` to indicate a reference cannot be resolved.r table_nameN)r2r3r4r5r6rHr"r!rrbs NOr"rceZdZdZdZy) AwaitRequiredzjError raised by the async greenlet spawn if no async operation was awaited when it required one. xd1rNr2r3r4r5rrHr"r!rrh Dr"rceZdZdZdZy)MissingGreenletzkError raised by the async greenlet await\_ if called while not inside the greenlet spawn context. xd2sNrrHr"r!rrqrr"rc eZdZdZddZddZy)NoReferencedTableErrorzQRaised by ``ForeignKey`` when the referred ``Table`` cannot be located. c>tj||||_yrG)rrr)rr/tnames r!rzNoReferencedTableError.__init__s!!$0r"cP|j|jd|jffSNr)r r=rr)s r!rUz!NoReferencedTableError.__reduce__s"~~ ! doo>>>r"N)r/rrrrVrmrHr"r!rrzs  ?r"rc eZdZdZddZddZy)NoReferencedColumnErrorzRRaised by ``ForeignKey`` when the referred ``Column`` cannot be located. cLtj||||_||_yrG)rrr column_name)rr/rcnames r!rz NoReferencedColumnError.__init__s!!!$0 r"cf|j|jd|j|jffSr)r r=rrr)s r!rUz"NoReferencedColumnError.__reduce__s/ NN YYq\4??D,<,< =  r"N)r/rrrrrrVrmrHr"r!rrs !  r"rceZdZdZy)NoSuchTableErrorz7Table does not exist or is not visible to a connection.NrKrHr"r!rrsAr"rceZdZdZy)UnreflectableTableErrorzUTable exists but can't be reflected for some reason. .. versionadded:: 1.2 NrKrHr"r!rrrLr"rceZdZdZy)UnboundExecutionErrorzASQL was attempted without a database connection to execute it on.NrKrHr"r!rrKr"rceZdZdZy) DontWrapMixina:A mixin class which, when applied to a user-defined Exception class, will not be wrapped inside of :exc:`.StatementError` if the error is emitted within the process of executing a statement. E.g.:: from sqlalchemy.exc import DontWrapMixin class MyCustomException(Exception, DontWrapMixin): pass class MySpecialType(TypeDecorator): impl = String def process_bind_param(self, value, dialect): if value == "invalid": raise MyCustomException("invalid!") NrKrHr"r!rrsr"rceZdZUdZdZded< dZded< dZded< dZd ed < d Z d ed < d ddZ ddZ ddZ e jdddZy)StatementErroravAn error occurred during execution of a SQL statement. :class:`StatementError` wraps the exception raised during execution, and features :attr:`.statement` and :attr:`.params` attributes which supply context regarding the specifics of the statement which had an issue. The wrapped exception object is available in the :attr:`.orig` attribute. Nr statementOptional[_AnyExecuteParams]paramsOptional[BaseException]origOptional[bool]ismultiFr{connection_invalidatedctj|||||_||_||_||_||_g|_y)Nrg)r:rrrrrhide_parametersdetail)rr/rrrrrrs r!rzStatementError.__init__sD   wT :"   .!# r"c:|jj|yrG)rappend)rrks r! add_detailzStatementError.add_details 3r"c |j|jd|j|j|j|j |j jd|jfd|jifS)Nrrr) r r=rrrr__dict__getrrr)s r!rUzStatementError.__reduce__sh NN !   $$ !!&)  t{{ #  r"zsqlalchemy.sql.utilctj}|jg}|jrd|jz}|j ||j rZ|j r|j dn<|j|j d|j}|j d|z|j}|r|j |dj|jDcgc]}d|z c}|zScc}w)Nz [SQL: %s]z3[SQL parameters hidden due to hide_parameters=True] )rz[parameters: %r] z(%s)) _preloadedsql_utilrCrrrr _repr_paramsrr*rhr)rutildetails stmt_detail params_reprcode_strdets r!rEzStatementError._sql_messages""==?# >>%6K NN; '{{''NNM#'"3"3 R#4#KNN#5 #CD>>#  NN8 $yy$++>3&3,>HII>s0 D)FNN)r/rrrrrrrrr{rrrr)rkrr1NonerVr0)r2r3r4r5rr6rrrrrrrUrpreload_modulerErHr"r!rrs  $I}#N*.F '.E$(D !(#G^"G#(D(!&""&$$!$, $ & $  $$ $$   Z45J6Jr"rc^eZdZdZdZee d d dZee d d dZee d d dZe d ddZddZ d dd Z y) DBAPIErrora Raised when the execution of a database operation fails. Wraps exceptions raised by the DB-API underlying the database operation. Driver-specific implementations of the standard DB-API exception types are wrapped by matching sub-types of SQLAlchemy's :class:`DBAPIError` when possible. DB-API's ``Error`` type maps to :class:`DBAPIError` in SQLAlchemy, otherwise the names are identical. Note that there is no guarantee that different DB-API implementations will raise the same exception type for any given error condition. :class:`DBAPIError` features :attr:`~.StatementError.statement` and :attr:`~.StatementError.params` attributes which supply context regarding the specifics of the statement which had an issue, for the typical case when the error was raised within the context of emitting a SQL statement. The wrapped exception object is available in the :attr:`~.StatementError.orig` attribute. Its type and properties are DB-API implementation specific. dbapiNc yrGrH clsrrrdbapi_base_errrrdialectrs r!instancezDBAPIError.instance4sr"c yrGrHrs r!rzDBAPIError.instanceBr"c yrGrHrs r!rzDBAPIError.instancePrr"c t|trt|trt|tr|S|*t|tr\|rZt d|j jd|j jd|jd|||||j|St||sD|rBt d|j jd|j jd||||||St} |j jD]K} | j} |r|jj| | } | | vs2t| | t sF| | }n|||||||j|S)N(.) r)rrr)rr)rrrr)r> BaseException Exceptionrr:rr r3r2r=rglobals__mro__dbapi_exception_translation_mapr issubclassr) rrrrrrrrrglobsuper_names r!rzDBAPIError.instance^sn t] +JtY4O m ,K  $0Y%11// !  $3#   n5)%11//  $3#  9D..00 "BBFFdD4 (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9))rr.)rr s r!r.z Base20DeprecationWarning.__str__$s GO N O r"r0)r2r3r4r5rr6r.r7r8s@r!rrs" ',m+I  r"rceZdZdZy)LegacyAPIWarningzEindicates an API that is in 'legacy' status, a long term deprecation.NrKrHr"r!rr+sOr"rceZdZdZy)MovedIn20WarningzASubtype of RemovedIn20Warning to indicate an API that moved only.NrKrHr"r!rr/rr"rc eZdZUdZdZded<y)SAPendingDeprecationWarningz}A similar warning as :class:`_exc.SADeprecationWarning`, this warning is not used in modern versions of SQLAlchemy. NrrrrHr"r!rr3s '+m*Ir"rceZdZdZdZy) SAWarningzIssued at runtime.warningN)r2r3r4r5r(rHr"r!rr=s Lr"r)Rr5 __future__rtypingrrrrrr r rr r r TYPE_CHECKINGengine.interfacesrr sql.compilerrr sql.elementsrr6rrrr:rJrNrQrXrZr\r^r`rorqrxrzrrrrrrrKeyErrorrrrrrrrrrrrrrrrrrrrrr r WarningrDeprecationWarningrrrrPendingDeprecationWarningrRuntimeWarningrrHr"r!r+s# ) 4*&*+ N:+#()+#\O= .} ./ /  . . M( o( V=?=P,P<FoF " "!,!$K?K/1"/" .(-( <+X< ' .* ') ?- ? . $B*B1L/L0VJ_VJrt=t=nZ J   } ] M }  J-/AJ 3 ,P/PL/LJ";J"Nr"