
    ,h!                      S r SSKJr  SSKrSSKJr  SSKrSSKJr  SSKrSSK	r	SSK
Jr  SSK
Jr  SSK
Jr  SS	K
Jr  SS
K
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
Jr  SSK
J r   SSK!J"r"  SSK!J#r#  SSK$J%r%  SS K$J&r&  SS!K'J(r(  SS"K#J)r)  SS#K#J*r*  SS$K#J+r+  SS%K#J,r,  S&S'K!J-r-  S&S(K!J.r.  S&S)K!J/r/  S&S*K/J0r0  S&S+K/J1r1  S&S,K/J
r2  S&S-K3J4r4  S&S.K3J5r5  S&S/K3J6r6  \(       a  SS0K!J7r7  SS1K!J8r8  SS2K!J9r9  SS3K:J;r;  SS4K:J<r<  SS5K=J>r>  SS6K?J@r@  SS7K8JArA  SS8K8JBrB  SS9K8JCrC  SS:K8JDrD  SS;K8JErE  SS<K8JFrF  SS=K8JGrG  SS>KHJIrI  SS?KHJJrJ  SS@KKJLrL  SSAKKJMrM  SSBKKJNrN  S&SCKOJPrP  S&SDKOJQrQ  S&SEKRJSrS  S&SFKRJTrT  S&SGKRJUrU  S&SHKRJVrV  S&SIKRJWrW  S&SJKRJXrX  S&SKKRJYrY  S&SLKRJZrZ  S&SMKRJ[r[  S&SNKRJ\r\  S&SOK-J]r]  \(       d  Sr7Sr8Sr9 " SP SQ\5      r^\^R                  r_ " SR SS\5      r`\`R                  rb\" ST\SU9rc\" SV\SW\4   SU9rd\\e\e4   rf " SX SY\5      rg\R                  " SZ5      ri " S[ S\\45      rj " S] S^\45      rkSS_ jrl\" S`\SU9rm " Sa Sb5      rn " Sc Sd\n5      ro    SSe jrp    SSf jrq\" SgShSU9rr " Si Sh\2Rh                  5      rsSSj jrtSSk jruSl rv    SSm jrw    SSn jrxSSo jrySSp jrz " Sq Sr\\e\4   5      r{ " Ss St\\e\4   5      r|\/R                  " Su5      Sv 5       r~ " Sw Sx5      r " Sy Sz5      r " S{ S|\05      r " S} S~\05      r " S S\5      r " S S\5      r " S S\S9r " S S\\%5      r " S S\(5      r " S S\"GR                  5      r " S S\-GR                  5      r " S S\\#GR                  5      r " S S\)5      r " S S\5      r " S S\5      r\" S\ S\e4   \e5      r\" SSSS9r\" SSSU9r " S S\\   5      r " S S\\\4   5      r\" SSSU9r " S S\\e\4   5      r " S S\/GR2                  \\\4   5      r " S S\/GR6                  S   5      r    SS jr\_4       SS jjrg)z4Foundational utilities common to many sql modules.

    )annotationsN)Enumzip_longest)Any)Callable)cast)Dict)	FrozenSet)Generic)Iterable)Iterator)List)Mapping)MutableMapping)
NamedTuple)NoReturn)Optional)overload)Sequence)Set)Tuple)Type)TYPE_CHECKING)TypeVar)Union   )roles)visitors)HasCacheKey)MemoizedHasCacheKey)HasCopyInternals)ClauseVisitor)ExtendedInternalTraversal)ExternallyTraversible)InternalTraversal   )event)exc)util)HasMemoized)hybridmethod)typing)Protocol)Self)	TypeGuard)	coercions)elements)type_api)DMLStrategyArgument)SynchronizeSessionArgument)_CLE)SQLCompiler)BindParameter)
ClauseList)ColumnClause)ColumnElement)NamedColumn)SQLCoreOperations)
TextClause)Column)DefaultGenerator)_JoinTargetElement)_SelectIterable)
FromClause)
Connection)CursorResult)_CoreMultiExecuteParams)_ExecuteOptions)_ImmutableExecuteOptions)
CacheStats)Compiled)CompiledCacheType)CoreExecuteOptionsParameter)Dialect)IsolationLevel)SchemaTranslateMapType)
dispatcherc                      \ rS rSrSrS rSrg)_NoArgh   r   c                     SU R                    3$ )Nz_NoArg.)nameselfs    K/var/www/auris/envauris/lib/python3.13/site-packages/sqlalchemy/sql/base.py__repr___NoArg.__repr__k   s    $$     N)__name__
__module____qualname____firstlineno__NO_ARGrY   __static_attributes__r\   r[   rX   rR   rR   h   s    F%r[   rR   c                      \ rS rSrSrSrg)	_NoneNamer   r   r\   N)r]   r^   r_   r`   	NONE_NAMErb   r\   r[   rX   rd   rd   r   s
    IHr[   rd   _T)bound_Fn.c                  Z    \ rS rSr% S\S'   S\S'   S\S'   S\S'   \    SS j5       rS	rg
)_DefaultDescriptionTuple   r   argzOptional[bool]	is_scalaris_callableis_sentinelc                    U(       ai  UR                   (       d"  UR                  (       dG  UR                  (       a6  [        UR                  UR
                  UR                  UR                  5      $ [        S S S S 5      $ N)has_arg
for_updaterp   rk   rm   rn   ro   )clsdefaults     rX   _from_column_default-_DefaultDescriptionTuple._from_column_default   se     **w/B/B %!!####		
 *$dDA	
r[   r\   N)rv   zOptional[DefaultGenerator]returnrk   )r]   r^   r_   r`   __annotations__classmethodrw   rb   r\   r[   rX   rk   rk      s;    	H
0
	!
 
r[   rk   _omit_from_statementsc                      \ rS rSrSS jrSrg)_EntityNamespace   c                    g rr   r\   rW   keys     rX   __getattr___EntityNamespace.__getattr__   s    sr[   r\   N)r   strry   SQLCoreOperations[Any])r]   r^   r_   r`   r   rb   r\   r[   rX   r~   r~      s    Br[   r~   c                  <    \ rS rSr\R
                  SS j5       rSrg)_HasEntityNamespace   c                    g rr   r\   rV   s    rX   entity_namespace$_HasEntityNamespace.entity_namespace   s    47r[   r\   N)ry   r~   )r]   r^   r_   r`   r*   ro_non_memoized_propertyr   rb   r\   r[   rX   r   r      s    	""7 #7r[   r   c                    [        U S5      $ )Nr   )hasattr)elements    rX   _is_has_entity_namespacer      s    7.//r[   _Selfc                  R    \ rS rSrSrSrSrS rS rSS jr	SS.     SS	 jjr
Srg
)	Immutable   a  mark a ClauseElement as 'immutable' when expressions are cloned.

"immutable" objects refers to the "mutability" of an object in the
context of SQL DQL and DML generation.   Such as, in DQL, one can
compose a SELECT or subquery of varied forms, but one cannot modify
the structure of a specific table or column within DQL.
:class:`.Immutable` is mostly intended to follow this concept, and as
such the primary "immutable" objects are :class:`.ColumnClause`,
:class:`.Column`, :class:`.TableClause`, :class:`.Table`.

r\   Tc                    [        S5      eNz(Immutable objects do not support copyingNotImplementedErrorrW   optionaldictkwargss      rX   unique_paramsImmutable.unique_params       !"LMMr[   c                    [        S5      er   r   r   s      rX   paramsImmutable.params   r   r[   c                    U $ rr   r\   rW   kws     rX   _cloneImmutable._clone   s    r[   )
omit_attrsc                   g rr   r\   )rW   r   r   s      rX   _copy_internalsImmutable._copy_internals   s     	r[   N)rW   r   r   r   ry   r   )r   zIterable[str]r   r   ry   None)r]   r^   r_   r`   __doc__	__slots___is_immutabler   r   r   r   rb   r\   r[   rX   r   r      sK    
 IMNN .0*7:	 r[   r   c                  j    \ rS rSr% SrSrS \S'   S
S jr\R                  SS j5       r
\S 5       rSrg	)SingletonConstant   z.Represent SQL constants like NULL, TRUE, FALSET
_singletonc                6    [        [        U R                  5      $ rr   )r	   rg   r   )ru   rm   r   s      rX   __new__SingletonConstant.__new__   s    B''r[   c                    [        5       err   r   rV   s    rX   	proxy_setSingletonConstant.proxy_set       !##r[   c                |    [         R                  U 5      nUR                  5         [        U/5      Ul        Xl        g rr   )objectr   __init__	frozensetr   r   )ru   objs     rX   _create_singleton#SingletonConstant._create_singleton   s.    nnS! "3%(r[   r\   N)ru   rg   rm   r   r   r   ry   rg   )ry   zFrozenSet[ColumnElement[Any]])r]   r^   r_   r`   r   _is_singleton_constantrz   r   r*   non_memoized_propertyr   r{   r   rb   r\   r[   rX   r   r      sD    8!!!( 
$  $  r[   r   c                 ~    [         R                  R                  U  Vs/ s H  oR                  PM     sn5      $ s  snf rr   )	itertoolschainfrom_iterable_from_objects)r2   r   s     rX   r   r      s4    
 ??((.67h7		h7 7   :c                ~    [         R                  R                  U  Vs/ s H  oR                  PM     sn5      $ s  snf )zPexpand tables into individual columns in the
given list of column expressions.

)r   r   r   _select_iterable)r2   cs     rX   _select_iterablesr      s4     ??((%-.X		X. .r   _SelfGenerativeType_GenerativeTypec                      \ rS rSrSS jrSrg)r   i  c                    g rr   r\   rV   s    rX   	_generate_GenerativeType._generate  s    r[   r\   Nry   r/   )r]   r^   r_   r`   r   rb   r\   r[   rX   r   r     s    $r[   c                f    [         R                            SS j5       nU" U 5      nXl        U$ )znon-caching _generative() decorator.

This is basically the legacy decorator that copies the object and
runs a method on the new copy.

c                T    UR                  5       nU " U/UQ70 UD6nXAL d   S5       eU$ )zMark a method as generative.z#generative methods must return self)r   )fnrW   argsr   xs        rX   _generative _generative.<locals>._generative  s9     ~~t!d!b!y???yr[   )
r   ri   rW   r   r   r   r   r   ry   r   )r*   	decoratornon_generative)r   r   	decorateds      rX   r   r   	  sY     
^^*36>A	  BI!r[   c            	       ^^ UR                  S0 5      mUR                  S0 5      nU  Vs/ s H,  nU[        R                  " U5      UR                  US 5      4PM.     snm[        R
                  UU4S j5       nU$ s  snf )Nmsgsdefaultsc           	        > US   nUSS  nT HV  u  pEnU" U5      ULd  M  T	R                  USU R                  < SUR                  < S35      n[        R                  " U5      e   U " U/UQ70 UD6$ )Nr   r   zMethod z$() has already been invoked on this z
 construct)getr]   	__class__r)   InvalidRequestError)
r   r   r   rW   rU   getterdefault_msggettersr   s
           rX   check!_exclusive_against.<locals>.check+  s     AwABx&-"D(d|8+hh{{DNN4
 --c22 '. $$$$$r[   )popoperator
attrgetterr   r*   r   )namesr   r   rU   r   r   r   s        @@rX   _exclusive_againstr   !  s    66&"Dvvj"%H D 
x""4((,,tT*BCG
 
^^% % L+s   3A=c                &    U R                   " S0 UD6$ Nr\   )r   )r   r   s     rX   r   r   >  s    >>Br[   c                f    [         R                  " U  Vs/ s H  oR                  PM     sn6 $ s  snf )zTexpand the given set of ClauseElements to be the set of all 'cloned'
predecessors.

)r   r   _cloned_setr2   r   s     rX   _expand_clonedr   B  s'     ??H=Hq]]H=>>=s   .c              #  v   #    U  H/  nUR                   b  UR                   nUR                   b  M  Uv   M1     g 7frr   )_is_clone_ofr   s     rX   	_de_cloner   M  s5      nn(A nn( s   ,9	9c                    [        [        U 5      5      R                  [        U5      5      nU  Vs1 s H&  o2R                  UR                  5      (       d  M$  UiM(     sn$ s  snf )zreturn the intersection of sets a and b, counting
any overlap between 'cloned' predecessors.

The returned set is in terms of the entities present within 'a'.

setr   intersectionr   aball_overlapelems       rX   _cloned_intersectionr  V  sL     nQ'(55nQ6GHKMQT":":4;K;K"LDQMMM   #A!A!c                    [        [        U 5      5      R                  [        U5      5      nU  Vs1 s H&  o2R                  UR                  5      (       a  M$  UiM(     sn$ s  snf rr   r   r   s       rX   _cloned_differencer  a  sS    nQ'(55nQ6GHK":":4;K;K"L  r  c                  F    \ rS rSrSrSrS rS rS rS r	S r
S	 rS
 rSrg)_DialectArgViewih  zYA dictionary view of dialect-level arguments in the form
<dialectname>_<argument_name>.

r   c                    Xl         g rr   r	  )rW   r   s     rX   r   _DialectArgView.__init__p  s    r[   c                n     UR                  SS5      u  p#X#4$ ! [         a  n[        U5      UeS nAff = f)N_r   )split
ValueErrorKeyError)rW   r   dialect	value_keyerrs        rX   _key_DialectArgView._keys  sC    	&!$3!2G %%  	)3-S(	)s    
4/4c                    U R                  U5      u  p# U R                  R                  U   nXC   $ ! [        R                   a  n[        U5      UeS nAff = frr   )r  r   dialect_optionsr)   NoSuchModuleErrorr  )rW   r   r  r  optr  s         rX   __getitem___DialectArgView.__getitem__{  sY    !YYs^	"((**73C >! $$ 	)3-S(	)s   2 AAAc                     U R                  U5      u  p4X R                  R                  U   U'   g ! [         a  n[        R
                  " S5      UeS nAff = f)Nz0Keys must be of the form <dialectname>_<argname>)r  r   r  r  r)   ArgumentError)rW   r   valuer  r  r  s         rX   __setitem___DialectArgView.__setitem__  s]    	A!%3G <AHH$$W-i8  	##B	s   1 
AAAc                ^    U R                  U5      u  p#U R                  R                  U   U	 g rr   )r  r   r  )rW   r   r  r  s       rX   __delitem___DialectArgView.__delitem__  s)    !YYs^HH$$W-i8r[   c                j    [        S U R                  R                  R                  5        5       5      $ )Nc              3  L   #    U  H  n[        UR                  5      v   M     g 7frr   )len_non_defaults).0r   s     rX   	<genexpr>*_DialectArgView.__len__.<locals>.<genexpr>  s%      
9 ""##9s   "$)sumr   r  valuesrV   s    rX   __len___DialectArgView.__len__  s/     
00779
 
 	
r[   c                D   ^  U 4S jT R                   R                   5       $ )Nc              3     >#    U  H9  nTR                   R                  U   R                    H  nU< S U< 3v   M     M;     g7f)r  N)r   r  r'  )r(  dialect_name
value_namerW   s      rX   r)  +_DialectArgView.__iter__.<locals>.<genexpr>  sH      
 8"hh66m
 $Z0 1 8s   AA)r   r  rV   s   `rX   __iter___DialectArgView.__iter__  s    
 $ 8 8
 	
r[   N)r]   r^   r_   r`   r   r   r   r  r  r  r"  r-  r4  rb   r\   r[   rX   r  r  h  s2    
 I&"A9

r[   r  c                  <    \ rS rSrSrS rS rS rS rS r	S r
S	rg
)_DialectArgDicti  zA dictionary view of dialect-level arguments for a specific
dialect.

Maintains a separate collection of user-specified arguments
and dialect-specified default arguments.

c                     0 U l         0 U l        g rr   r'  	_defaultsrV   s    rX   r   _DialectArgDict.__init__  s    r[   c                p    [        [        U R                  5      R                  U R                  5      5      $ rr   )r&  r   r'  unionr:  rV   s    rX   r-  _DialectArgDict.__len__  s'    3t))*00@AAr[   c                p    [        [        U R                  5      R                  U R                  5      5      $ rr   )iterr   r'  r=  r:  rV   s    rX   r4  _DialectArgDict.__iter__  s'    C**+11$..ABBr[   c                \    XR                   ;   a  U R                   U   $ U R                  U   $ rr   r9  r   s     rX   r  _DialectArgDict.__getitem__  s.    $$$%%c**>>#&&r[   c                     X R                   U'   g rr   r'  rW   r   r  s      rX   r  _DialectArgDict.__setitem__  s    "'3r[   c                    U R                   U	 g rr   rE  r   s     rX   r"  _DialectArgDict.__delitem__  s    s#r[   )r:  r'  N)r]   r^   r_   r`   r   r   r-  r4  r  r  r"  rb   r\   r[   rX   r7  r7    s'    BC'($r[   r7  zsqlalchemy.dialectsc                    [         R                  R                  R                  R	                  U 5      nUR
                  c  g [        UR
                  5      $ rr   )r*   	preloadeddialectsregistryloadconstruct_argumentsdict)r1  dialect_clss     rX   _kw_reg_for_dialectrR    sB    ..))2277EK&&.//00r[   c                      \ rS rSrSrSrS\R                  4/r\	S 5       r
\S 5       r\S 5       r\R                  " \5      r\	S 5       r\R&                  S	 5       rSS
 jrSrg)DialectKWArgsi  a!  Establish the ability for a class to have dialect-specific arguments
with defaults and constructor validation.

The :class:`.DialectKWArgs` interacts with the
:attr:`.DefaultDialect.construct_arguments` present on a dialect.

.. seealso::

    :attr:`.DefaultDialect.construct_arguments`

r\   r  c                    [         R                  U   nUc  [        R                  " SU-  5      eX;  a  0 X@'   X4U    U'   g)a  Add a new kind of dialect-specific keyword argument for this class.

E.g.::

    Index.argument_for("mydialect", "length", None)

    some_index = Index("a", "b", mydialect_length=5)

The :meth:`.DialectKWArgs.argument_for` method is a per-argument
way adding extra arguments to the
:attr:`.DefaultDialect.construct_arguments` dictionary. This
dictionary provides a list of argument names accepted by various
schema-level constructs on behalf of a dialect.

New dialects should typically specify this dictionary all at once as a
data member of the dialect class.  The use case for ad-hoc addition of
argument names is typically for end-user code that is also using
a custom compilation scheme which consumes the additional arguments.

:param dialect_name: name of a dialect.  The dialect must be
 locatable, else a :class:`.NoSuchModuleError` is raised.   The
 dialect must also include an existing
 :attr:`.DefaultDialect.construct_arguments` collection, indicating
 that it participates in the keyword-argument validation and default
 system, else :class:`.ArgumentError` is raised.  If the dialect does
 not include this collection, then any keyword argument can be
 specified on behalf of this dialect already.  All dialects packaged
 within SQLAlchemy include this collection, however for third party
 dialects, support may vary.

:param argument_name: name of the parameter.

:param default: default value of the parameter.

NzRDialect '%s' does have keyword-argument validation and defaults enabled configured)rT  _kw_registryr)   r  )ru   r1  argument_namerv   construct_arg_dictionarys        rX   argument_forDialectKWArgs.argument_for  s[    L $1#=#=l#K #+##=?KL  .,.$)7>%m4r[   c                    [        U 5      $ )aL  A collection of keyword arguments specified as dialect-specific
options to this construct.

The arguments are present here in their original ``<dialect>_<kwarg>``
format.  Only arguments that were actually passed are included;
unlike the :attr:`.DialectKWArgs.dialect_options` collection, which
contains all options known by this dialect including defaults.

The collection is also writable; keys are accepted of the
form ``<dialect>_<kwarg>`` where the value will be assembled
into the list of options.

.. seealso::

    :attr:`.DialectKWArgs.dialect_options` - nested dictionary form

)r  rV   s    rX   dialect_kwargsDialectKWArgs.dialect_kwargs  s    & t$$r[   c                    U R                   $ )z4A synonym for :attr:`.DialectKWArgs.dialect_kwargs`.)r\  rV   s    rX   r   DialectKWArgs.kwargs#  s     """r[   c                   [         R                  U   n[        5       nUc  UR                  R	                  SS 05        U$ [        U R                  5       H'  n X;   d  M
  UR                  R	                  X    5        M)     U$ )N*)rT  rV  r7  r:  updatereversed__mro__)ru   r1  rX  ds       rX   _kw_reg_for_dialect_cls%DialectKWArgs._kw_reg_for_dialect_cls*  sv    #0#=#=l#K #+KKT{+
   ,2KK&&'?'DE - r[   c                B    [         R                  " U R                  5      $ )a  A collection of keyword arguments specified as dialect-specific
options to this construct.

This is a two-level nested registry, keyed to ``<dialect_name>``
and ``<argument_name>``.  For example, the ``postgresql_where``
argument would be locatable as::

    arg = my_object.dialect_options["postgresql"]["where"]

.. versionadded:: 0.9.2

.. seealso::

    :attr:`.DialectKWArgs.dialect_kwargs` - flat dictionary form

)r*   PopulateDictrf  rV   s    rX   r  DialectKWArgs.dialect_options7  s    &   !=!=>>r[   c           	     B   U(       d  g U H  n[         R                  " SU5      nU(       d  [        SU-  5      eUR                  SS5      u  pE U R                  U   nSU;  a1  XV;  a,  [
        R                  " SU< SU< SU R                  < 35      eX   Xe'   M     g ! [
        R                   aj    [        R                  " S	U< S
U< 35        [        5       =U R                  U'   nUR                  R                  SS 05        X   UR                  U'    GM  f = f)Nz^(.+?)_(.+)$zGAdditional arguments should be named <dialectname>_<argument>, got '%s'r   r'   ra  z	Argument z is not accepted by dialect z on behalf of zCan't validate argument z,; can't locate any SQLAlchemy dialect named )rematch	TypeErrorgroupr  r)   r  r   r  r*   warnr7  r:  rb  r'  )rW   r   kmr1  arg_namerX  re  s           rX   _validate_dialect_kwargs&DialectKWArgs._validate_dialect_kwargsL  s!    A+A?ABC  &'WWQ]"LC+/+?+?+M( 77 @++ lDNN<  :@,6?  (( 6		 ,(
 :I9JJ$$\2Q""C;/,2I)6s   B  A9DDN)r   Dict[str, Any]ry   r   )r]   r^   r_   r`   r   r   r&   dp_dialect_options"_dialect_kwargs_traverse_internalsr{   rY  propertyr\  r   r*   ri  rR  rV  rf  memoized_propertyr  rt  rb   r\   r[   rX   rT  rT    s    
 I 
-@@A*& -? -?^ % %( # # $$%89L
 
 
? ?(%Cr[   rT  c                      \ rS rSr% SrSr0 rS\S'   S\S'   \        SS j5       r	S	 r
\    SS
 j5       r\      SS j5       r\      SS j5       rSrg)CompileStateit  a  Produces additional object state necessary for a statement to be
compiled.

the :class:`.CompileState` class is at the base of classes that assemble
state for a particular statement object that is then used by the
compiler.   This process is essentially an extension of the process that
the SQLCompiler.visit_XYZ() method takes, however there is an emphasis
on converting raw user intent into more organized structures rather than
producing string output.   The top-level :class:`.CompileState` for the
statement being executed is also accessible when the execution context
works with invoking the statement and collecting results.

The production of :class:`.CompileState` is specific to the compiler,  such
as within the :meth:`.SQLCompiler.visit_insert`,
:meth:`.SQLCompiler.visit_select` etc. methods.  These methods are also
responsible for associating the :class:`.CompileState` with the
:class:`.SQLCompiler` itself, if the statement is the "toplevel" statement,
i.e. the outermost SQL statement that's actually being executed.
There can be other :class:`.CompileState` objects that are not the
toplevel, such as when a SELECT subquery or CTE-nested
INSERT/UPDATE/DELETE is generated.

.. versionadded:: 1.4

)	statement_ambiguous_table_name_mapz)Dict[Tuple[str, str], Type[CompileState]]pluginsz Optional[_AmbiguousTableNameMap]r~  c                ^   UR                   (       ab  UR                   R                  SS5      nU R                  R                  XAR                  4S 5      nUc  U R                  SUR                  4   nOU R                  SUR                  4   nXPL a	  U " X40 UD6$ UR                  " X40 UD6$ Ncompile_state_pluginrv   )_propagate_attrsr   r  _effective_plugin_targetcreate_for_statement)ru   r}  compilerr   plugin_nameklasss         rX   r  !CompileState.create_for_statement  s     %%#4488&	K KKOO@@A4E }	 B BC
 KKI>>?E <y1b11--iHRHHr[   c                    Xl         g rr   r}  )rW   r}  r  r   s       rX   r   CompileState.__init__  s    "r[   c                    UR                   R                  SS 5      nU(       a+  X!R                  4nX0R                  ;   a  U R                  U   $  U R                  SUR                  4   $ ! [         a     g f = fr  )r  r   r  r  r  )ru   r}  r  r   s       rX   get_plugin_classCompileState.get_plugin_class  s|      0044"D
  B BCCkk!{{3''	;;	9+M+MNOO 		s   A+ +
A87A8c                X     U R                   X!R                  4   $ ! [         a     g f = frr   )r  r  r  )ru   r}  r  s      rX   _get_plugin_class_for_plugin)CompileState._get_plugin_class_for_plugin  s8    	;;@@A   		s    
))c                   ^ ^^ U UU4S jnU$ )Nc                *   > U TR                   TT4'   U $ rr   )r  )cls_to_decorateru   r  
visit_names    rX   decorate)CompileState.plugin_for.<locals>.decorate  s    5DCKKj12""r[   r\   )ru   r  r  r  s   ``` rX   
plugin_forCompileState.plugin_for  s    	# r[   r  N)r}  
Executabler  r7   r   r   ry   r|  )r}  r  ry   Optional[Type[CompileState]])r}  r  r  r   ry   r  )r  r   r  r   ry   Callable[[_Fn], _Fn])r]   r^   r_   r`   r   r   r  rz   r{   r  r   r  r  r  rb   r\   r[   rX   r|  r|  t  s    4 ;I9;G6;??I"I.9IADI	I I6# "	% * "14	%  +.	 r[   r|  c                  "    \ rS rSrSrSS jrSrg)
Generativei  zQProvide a method-chaining pattern in conjunction with the
@_generative decorator.c                F   U R                   nU R                  nUR                  U5      nU(       aK  U R                  R	                  5       R                  5        VVs0 s H  u  pEXA;  d  M  XE_M     snnUl        U$ U R                  R	                  5       Ul        U$ s  snnf rr   )_memoized_keysr   r   __dict__copyitems)rW   skipru   srq  vs         rX   r   Generative._generate  s    ""nnKK "&!3!3!5!;!;!=!=!=AJ
  ++-AJs   B+Br\   Nr   )r]   r^   r_   r`   r   r   rb   r\   r[   rX   r  r    s    r[   r  c                  "    \ rS rSrSrSrS rSrg)InPlaceGenerativei  zgProvide a method-chaining pattern in conjunction with the
@_generative decorator that mutates in place.r\   c                h    U R                   nU H  nU R                  R                  US 5        M!     U $ rr   )r  r  r   )rW   r  rq  s      rX   r   InPlaceGenerative._generate  s0    ""AMMa& r[   N)r]   r^   r_   r`   r   r   r   rb   r\   r[   rX   r  r    s    5 Ir[   r  c                  b    \ rS rSr% SrSrS\S'   \R                  r	S\S'   \
R                  rSrg)	HasCompileStatei   z=A class that has a :class:`.CompileState` associated with it.Nr  _compile_state_pluginutil.immutabledict[str, Any]_attributesr\   )r]   r^   r_   r`   r   r  rz   r*   
EMPTY_DICTr  r|  r  _compile_state_factoryrb   r\   r[   rX   r  r     s,    G:>7>04K-?)>>r[   r  c                  \    \ rS rSr% SrS\S'   S r\(       a  SS jrSS jr	SS jr
S	rg
S	rg
)_MetaOptionsi
  zmetaclass for the Options class.

This metaclass is actually necessary despite the availability of the
``__init_subclass__()`` hook as this type also provides custom class-level
behavior for the ``__add__()`` method.

Tuple[str, ...]_cache_attrsc                   U " 5       n[        U5      R                  U R                  5      (       a5  [        SU < S[        U5      R                  U R                  5      < 35      eUR                  R                  U5        U$ Nz<dictionary contains attributes not covered by Options class z: )r   
differencer  rn  r  rb  rW   othero1s      rX   __add___MetaOptions.__add__  sl    Vu:  !2!233 U..t/@/@AC  	5!	r[   c                    g rr   r\   r   s     rX   r   _MetaOptions.__getattr__$      r[   c                    g rr   r\   rF  s      rX   __setattr___MetaOptions.__setattr__&      Sr[   c                    g rr   r\   r   s     rX   __delattr___MetaOptions.__delattr__(      r[   r\   Nr   r   ry   r   r   r   r  r   ry   r   r   r   ry   r   )r]   r^   r_   r`   r   rz   r  r   r   r  r  rb   r\   r[   rX   r  r  
  s'     "! 3@4 r[   r  c                  2  ^  \ rS rSr% SrSrS\S'   SU 4S jjrS rS r	S	 r
S
 r\SS j5       r\S 5       r\SS j5       r\R$                  rS\S'   \R(                  SS j5       r\S 5       r\S 5       r\(       a  SS jrSS jrSS jrSrU =r$ SrU =r$ )Optionsi+  z,A cacheable option dictionary with defaults.r\   r  r  c                z   > U R                   n[        [        S U 5       5      5      U l        [        TU ]  5         g )Nc              3  f   #    U  H'  nUR                  S 5      (       a  M  US;  d  M#  Uv   M)     g7f)__)_cache_key_traversalN)
startswith)r(  re  s     rX   r)  ,Options.__init_subclass__.<locals>.<genexpr>5  s5      A||D)  66 s   11	1)r  tuplesortedr  super__init_subclass__)ru   dict_r   s     rX   r  Options.__init_subclass__2  s;       
 	!#r[   c                :    U R                   R                  U5        g rr   )r  rb  r   s     rX   r   Options.__init__>  s    R r[   c                   U R                   R                  U R                   5      nUR                  R                  U R                  5        [	        U5      R                  U R                  5      (       a5  [        SU < S[	        U5      R                  U R                  5      < 35      eUR                  R                  U5        U$ r  )r   r   r  rb  r   r  r  rn  r  s      rX   r  Options.__add__A  s    ^^##DNN3
4==)u:  !2!233 U..t/@/@AC  	5!	r[   c                    [        U R                  UR                  5       H  u  p#[        X5      [        X5      :w  d  M    g   gNFT)r   r  getattr)rW   r  r   r   s       rX   __eq__Options.__eq__O  s>       1 153E3EFDAt75#44 G r[   c                   ^  T R                   R                  < SSR                  U 4S jT R                   5       5      < S3$ )N(, c              3  t   >#    U  H-  nUTR                   ;   d  M  U< S TR                   U   < 3v   M/     g7f)=Nr  )r(  rq  rW   s     rX   r)  #Options.__repr__.<locals>.<genexpr>\  s4      *A% 01dmmA./*s   88))r   r]   joinr  rV   s   `rX   rY   Options.__repr__W  s;     NN##II ** 
 	
r[   c                    [        X5      $ rr   )
issubclass)ru   r  s     rX   
isinstanceOptions.isinstancec  s    #%%r[   c                &    X[        X5      U-   0-   $ rr   )r  )rW   rU   r  s      rX   add_to_elementOptions.add_to_elementg  s    WT058999r[   c                    U R                   $ rr   r  rV   s    rX   _state_dict_instOptions._state_dict_instk  s    }}r[   r  _state_dict_constc                    U R                   $ rr   )r  )ru   s    rX   _state_dictOptions._state_dictq  s    $$$r[   c           
     T   UR                  5       nXR                  La  UR                  (       av  [        UR                  5      R	                  U R                  5      (       aC  [        SU< SU < S[        UR                  5      R	                  U R                  5      < 35      eX-   $ )Nzother element z is not empty, is not of type z+, and contains attributes not covered here )r  r   r  r   r  rn  )ru   r  re  s      rX   
safe_mergeOptions.safe_mergeu  s     &""E&&'2233C3CDD **+66s7G7GH  wr[   c                8   UR                  [        U5      R                  U5      5      nUR                  X5      nU(       aW  0 nU H"  nSU-   n	X;   a  X8   Xy'   M  X;   d  M  XH   Xy'   M$     Xg-   n
[        R
                  " 5       R                  X1U
05      nX4$ Xc4$ )a  process Options argument in terms of execution options.


e.g.::

    (
        load_options,
        execution_options,
    ) = QueryContext.default_load_options.from_execution_options(
        "_sa_orm_load_options",
        {"populate_existing", "autoflush", "yield_per"},
        execution_options,
        statement._execution_options,
    )

get back the Options and refresh "_sa_orm_load_options" in the
exec options dict w/ the Options as well

r  )r   r   r=  r   r*   immutabledict
merge_with)ru   r   attrsexec_optionsstatement_exec_optionscheck_argnamesexisting_optionsresultargnamelocalnew_optionss              rX   from_execution_optionsOptions.from_execution_options  s    4 ++##$:;
 (++C5F)g*$0$9FM6$:$CFM * +3K--/::K0L ,, $11r[   c                    g rr   r\   r   s     rX   r   Options.__getattr__  r  r[   c                    g rr   r\   rF  s      rX   r  Options.__setattr__  r  r[   c                    g rr   r\   r   s     rX   r  Options.__delattr__  r  r[   )ry   r   )r  z	Type[Any]ry   bool)ry   zMapping[str, Any]r  r  r  )r]   r^   r_   r`   r   r   rz   r  r   r  r  rY   r{   r  r,   r  r  r*   r  r  
classlevelr  r  r  r   r   r  r  rb   __classcell__)r   s   @rX   r  r  +  s    6I!!
$!

 & & : :   7;oo3E  % !%  0 /2 /2b 3@44 r[   r  )	metaclassc                  \    \ rS rSrSr\S 5       r\R                  S 5       r\S 5       r	Sr
g)CacheableOptionsi  r\   c                0    [         R                  " XU5      $ rr   )r    _gen_cache_key)rW   anon_map
bindparamss      rX   _gen_cache_key_inst$CacheableOptions._gen_cache_key_inst  s    ))$*EEr[   c                
    U S4$ r   r\   )ru   r  r  s      rX   r  CacheableOptions._gen_cache_key  s    Ryr[   c                .    [         R                  " U 5      $ rr   )r    _generate_cache_key_for_objectrV   s    rX   _generate_cache_key$CacheableOptions._generate_cache_key  s    99$??r[   N)r]   r^   r_   r`   r   r,   r  r  r  r$  rb   r\   r[   rX   r  r    sK    IF F ## $ @ @r[   r  c                  B    \ rS rSrSr\R                  rSrSr	Sr
S rSrg)ExecutableOptioni  r\   executable_optionFTc                    U R                   R                  U R                   5      n[        U R                  5      Ul        U$ )z/Create a shallow copy of this ExecutableOption.)r   r   rP  r  )rW   r   r   s      rX   r   ExecutableOption._clone  s/    NN""4>>2$--(
r[   N)r]   r^   r_   r`   r   r*   r  _annotations__visit_name___is_has_cache_key_is_corer   rb   r\   r[   rX   r'  r'    s%    I??L(NHr[   r'  c                     \ rS rSr% SrSrS\S'   \R                  r	S\S'   Sr
S	rS
\S'   S	rS\S'   S\S'   S\R                  4S\R                   4S\R"                  4/rSrSrSrSrSrSrSr\(       a6  S\S'   SSS.             S%S jjr        S&S jr        S'S jr\R<                  S 5       r\ S(S j5       r!\"S)S j5       r#\"S*S j5       r$\"S+S j5       r%\"      S,S j5       r&\'SSSSSSSSSSSSSSSSSS.                                     S-S  jj5       r(\'S.S! j5       r(\"S/S" j5       r(S0S# jr)S$r*g)1r  i  zMark a :class:`_expression.ClauseElement` as supporting execution.

:class:`.Executable` is a superclass for all "statement" types
of objects, including :func:`select`, :func:`delete`, :func:`update`,
:func:`insert`, :func:`text`.

Tr  supports_executionrH   _execution_optionsFr\   zTuple[ExecutableOption, ...]_with_optionsz6Tuple[Tuple[Callable[[CompileState], None], Any], ...]_with_context_optionsz9Optional[Union[Type[CacheableOptions], CacheableOptions]]_compile_optionsr  r   r,  N)for_executemanyschema_translate_mapc                   g rr   r\   )rW   r  compiled_cachecolumn_keysr5  r6  r   s          rX   _compile_w_cacheExecutable._compile_w_cache  s     r[   c                    g rr   r\   rW   
connectiondistilled_paramsexecution_optionss       rX   _execute_on_connection!Executable._execute_on_connection  s    
 !$r[   c                    g rr   r\   r=  s       rX   _execute_on_scalarExecutable._execute_on_scalar%  s    
 r[   c                    [        5       err   r   rV   s    rX   _all_selected_columns Executable._all_selected_columns,  r   r[   c                    U R                   $ rr   )r,  rV   s    rX   r  #Executable._effective_plugin_target0  s    """r[   c                P    U =R                   [        S U 5       5      -  sl         U $ )a  Apply options to this statement.

In the general sense, options are any kind of Python object
that can be interpreted by the SQL compiler for the statement.
These options can be consumed by specific dialects or specific kinds
of compilers.

The most commonly known kind of option are the ORM level options
that apply "eager load" and other loading behaviors to an ORM
query.   However, options can theoretically be used for many other
purposes.

For background on specific kinds of options for specific kinds of
statements, refer to the documentation for those option objects.

.. versionchanged:: 1.4 - added :meth:`.Executable.options` to
   Core statement objects towards the goal of allowing unified
   Core / ORM querying capabilities.

.. seealso::

    :ref:`loading_columns` - refers to options specific to the usage
    of ORM queries

    :ref:`relationship_loader_options` - refers to options specific
    to the usage of ORM queries

c              3  l   #    U  H*  n[         R                  " [        R                  U5      v   M,     g 7frr   )r1   expectr   ExecutableOptionRole)r(  r  s     rX   r)  %Executable.options.<locals>.<genexpr>R  s-      $
 U77==s   24)r2  r  rW   optionss     rX   rQ  Executable.options4  s0    < 	e $
$
 
 	
 r[   c                    Xl         U $ )zlAssign the compile options to a new value.

:param compile_options: appropriate CacheableOptions structure

r4  )rW   compile_optionss     rX   _set_compile_optionsExecutable._set_compile_optionsX  s     !0r[   c                N    U R                   c   eU =R                   U-  sl         U $ )z*update the _compile_options with new keys.rT  rP  s     rX   _update_compile_options"Executable._update_compile_optionsc  s,     $$000(r[   c                4    U =R                   X44-  sl         U $ )a  Add a context option to this statement.

These are callable functions that will
be given the CompileState object upon compilation.

A second argument cache_args is required, which will be combined with
the ``__code__`` identity of the function itself in order to produce a
cache key.

)r3  )rW   	callable_
cache_argss      rX   _add_context_optionExecutable._add_context_optionk  s       	""	'>&@@"r[   .)r8  logging_tokenisolation_levelno_parametersstream_resultsmax_row_buffer	yield_perinsertmanyvalues_page_sizer6  populate_existing	autoflushsynchronize_sessiondml_strategyrender_nullsis_delete_usingis_update_frompreserve_rowcountc                   g rr   r\   )rW   r8  r`  ra  rb  rc  rd  re  rf  r6  rg  rh  ri  rj  rk  rl  rm  rn  r  s                      rX   r@  Executable.execution_options~  s    , r[   c                    g rr   r\   )rW   r  s     rX   r@  rp    s    58r[   c                    SU;   a  [         R                  " S5      eSU;   a  [         R                  " S5      eU R                  R                  U5      U l        U $ )a.  Set non-SQL options for the statement which take effect during
execution.

Execution options can be set at many scopes, including per-statement,
per-connection, or per execution, using methods such as
:meth:`_engine.Connection.execution_options` and parameters which
accept a dictionary of options such as
:paramref:`_engine.Connection.execute.execution_options` and
:paramref:`_orm.Session.execute.execution_options`.

The primary characteristic of an execution option, as opposed to
other kinds of options such as ORM loader options, is that
**execution options never affect the compiled SQL of a query, only
things that affect how the SQL statement itself is invoked or how
results are fetched**.  That is, execution options are not part of
what's accommodated by SQL compilation nor are they considered part of
the cached state of a statement.

The :meth:`_sql.Executable.execution_options` method is
:term:`generative`, as
is the case for the method as applied to the :class:`_engine.Engine`
and :class:`_orm.Query` objects, which means when the method is called,
a copy of the object is returned, which applies the given parameters to
that new copy, but leaves the original unchanged::

    statement = select(table.c.x, table.c.y)
    new_statement = statement.execution_options(my_option=True)

An exception to this behavior is the :class:`_engine.Connection`
object, where the :meth:`_engine.Connection.execution_options` method
is explicitly **not** generative.

The kinds of options that may be passed to
:meth:`_sql.Executable.execution_options` and other related methods and
parameter dictionaries include parameters that are explicitly consumed
by SQLAlchemy Core or ORM, as well as arbitrary keyword arguments not
defined by SQLAlchemy, which means the methods and/or parameter
dictionaries may be used for user-defined parameters that interact with
custom code, which may access the parameters using methods such as
:meth:`_sql.Executable.get_execution_options` and
:meth:`_engine.Connection.get_execution_options`, or within selected
event hooks using a dedicated ``execution_options`` event parameter
such as
:paramref:`_events.ConnectionEvents.before_execute.execution_options`
or :attr:`_orm.ORMExecuteState.execution_options`, e.g.::

     from sqlalchemy import event


     @event.listens_for(some_engine, "before_execute")
     def _process_opt(conn, statement, multiparams, params, execution_options):
         "run a SQL function before invoking a statement"

         if execution_options.get("do_special_thing", False):
             conn.exec_driver_sql("run_special_function()")

Within the scope of options that are explicitly recognized by
SQLAlchemy, most apply to specific classes of objects and not others.
The most common execution options include:

* :paramref:`_engine.Connection.execution_options.isolation_level` -
  sets the isolation level for a connection or a class of connections
  via an :class:`_engine.Engine`.  This option is accepted only
  by :class:`_engine.Connection` or :class:`_engine.Engine`.

* :paramref:`_engine.Connection.execution_options.stream_results` -
  indicates results should be fetched using a server side cursor;
  this option is accepted by :class:`_engine.Connection`, by the
  :paramref:`_engine.Connection.execute.execution_options` parameter
  on :meth:`_engine.Connection.execute`, and additionally by
  :meth:`_sql.Executable.execution_options` on a SQL statement object,
  as well as by ORM constructs like :meth:`_orm.Session.execute`.

* :paramref:`_engine.Connection.execution_options.compiled_cache` -
  indicates a dictionary that will serve as the
  :ref:`SQL compilation cache <sql_caching>`
  for a :class:`_engine.Connection` or :class:`_engine.Engine`, as
  well as for ORM methods like :meth:`_orm.Session.execute`.
  Can be passed as ``None`` to disable caching for statements.
  This option is not accepted by
  :meth:`_sql.Executable.execution_options` as it is inadvisable to
  carry along a compilation cache within a statement object.

* :paramref:`_engine.Connection.execution_options.schema_translate_map`
  - a mapping of schema names used by the
  :ref:`Schema Translate Map <schema_translating>` feature, accepted
  by :class:`_engine.Connection`, :class:`_engine.Engine`,
  :class:`_sql.Executable`, as well as by ORM constructs
  like :meth:`_orm.Session.execute`.

.. seealso::

    :meth:`_engine.Connection.execution_options`

    :paramref:`_engine.Connection.execute.execution_options`

    :paramref:`_orm.Session.execute.execution_options`

    :ref:`orm_queryguide_execution_options` - documentation on all
    ORM-specific execution options

ra  z'isolation_level' execution option may only be specified on Connection.execution_options(), or per-engine using the isolation_level argument to create_engine().r8  zm'compiled_cache' execution option may only be specified on Connection.execution_options(), not per statement.)r)   r  r1  r=  r   s     rX   r@  rp    sh    P "##/  r!##H  #'"9"9"?"?"Cr[   c                    U R                   $ )zGet the non-SQL options which will take effect during execution.

.. versionadded:: 1.3

.. seealso::

    :meth:`.Executable.execution_options`
)r1  rV   s    rX   get_execution_options Executable.get_execution_options  s     &&&r[   )r4  r1  )r  rM   r8  Optional[CompiledCacheType]r9  z	List[str]r5  r  r6   Optional[SchemaTranslateMapType]r   r   ry   zCTuple[Compiled, Optional[Sequence[BindParameter[Any]]], CacheStats])r>  rD   r?  rF   r@  rL   ry   zCursorResult[Any])r>  rD   r?  rF   r@  rL   ry   r   ry   r   )rQ  r'  ry   r/   )rU  r  ry   r/   )rQ  r  ry   r/   )r\  zCallable[[CompileState], None]r]  r   ry   r/   )&r8  rv  r`  r   ra  rN   rb  r  rc  r  rd  intre  ry  rf  ry  r6  rw  rg  r  rh  r  ri  r5   rj  r4   rk  r  rl  r  rm  r  rn  r  r  r   ry   r/   )r  r   ry   r/   )r   r   ry   r/   )ry   rG   )+r]   r^   r_   r`   r   r0  rz   r*   r  r1  _is_default_generatorr2  r3  r&   dp_executable_optionsr$   dp_with_context_optionsdp_propagate_attrs_executable_traverse_internals	is_selectis_from_statement	is_update	is_insertis_text	is_deleteis_dmlr   r:  rA  rD  r   rG  ry  r  r   rQ  rV  rY  r^  r   r@  rt  rb   r\   r[   rX   r  r    s0     $#37??0B!24M/4 	    PO 
+AAB#%==	
 
6IIJ&" IIIGIF %*EI		 8		
 #	 "	 #C	 	
		$"	$ 6	$  ;		$
 	$	"	 6	  ;		
 	 
""$ #$ # # ! !F     1  
	 $  7: *-#$!*-AD"':=,/  #""'' 4 	
 (     %( ?    8 *  !" #$ %&  '( )* 
+ . 8 8t tl	'r[   r  c                  D    \ rS rSr% SrS\S'   S	S jr      S	S jrSrg)
SchemaEventTargeti  zBase class for elements that are the targets of :class:`.DDLEvents`
events.

This includes :class:`.SchemaItem` as well as :class:`.SchemaType`.

zdispatcher[SchemaEventTarget]dispatchc                    g)z0Associate with this SchemaEvent's parent object.Nr\   rW   parentr   s      rX   _set_parentSchemaEventTarget._set_parent&  s    r[   c                    U R                   R                  X5        U R                  " U40 UD6  U R                   R                  X5        g rr   )r  before_parent_attachr  after_parent_attachr  s      rX   _set_parent_with_dispatch+SchemaEventTarget._set_parent_with_dispatch)  s;     	**48&2&))$7r[   r\   N)r  r  r   r   ry   r   )	r]   r^   r_   r`   r   rz   r  r  rb   r\   r[   rX   r  r    s1     ,+?8'8/28	8r[   r  c                      \ rS rSrSrSrg)SchemaVisitablei1  zbBase class for elements that are targets of a :class:`.SchemaVisitor`.

.. versionadded:: 2.0.41

r\   N)r]   r^   r_   r`   r   rb   r\   r[   rX   r  r  1  s    r[   r  c                       \ rS rSrSrSS0rSrg)SchemaVisitori9  zXDefine the visiting for ``SchemaItem`` and more
generally ``SchemaVisitable`` objects.

schema_visitorTr\   N)r]   r^   r_   r`   r   __traverse_options__rb   r\   r[   rX   r  r  9  s    
 -d3r[   r  c                  0    \ rS rSrSrSrSrSrSrSr	Sr
S	rg
) _SentinelDefaultCharacterizationiB  noneunknown
clientsidesentinel_default
serversideidentitysequencer\   N)r]   r^   r_   r`   NONEUNKNOWN
CLIENTSIDESENTINEL_DEFAULT
SERVERSIDEIDENTITYSEQUENCErb   r\   r[   rX   r  r  B  s&    DGJ)JHHr[   r  c                  b    \ rS rSr% SrS\S'   SrS\S'   SrS\S'   \R                  r
S	\S
'   Srg)_SentinelColumnCharacterizationiL  NzOptional[Sequence[Column[Any]]]columnsFr  is_explicit
is_autoincr  default_characterizationr\   )r]   r^   r_   r`   r  rz   r  r  r  r  r  rb   r\   r[   rX   r  r  L  s7    /3G,3KJ(-- > r[   r  _COLKEY_COL_coColumnElement[Any]T)rh   	covariant_COLc                  T    \ rS rSr% SrS\S'       S
S jrS rS r    SS jr	Sr
g	)_ColumnMetricsi[  )columnr  r  c                    X l         UR                  nU(       a'  UR                   H  nX4   R                  U 5        M     g g rr   )r  _proxy_index_expanded_proxy_setadd)rW   
collectioncolpieps_cols        rX   r   _ColumnMetrics.__init__`  s<      $$22% 3 r[   c                .    U R                   R                  $ rr   )r  r  rV   s    rX   get_expanded_proxy_set%_ColumnMetrics.get_expanded_proxy_setl  s    {{...r[   c                    UR                   nU(       d  g U R                  R                   H=  nUR                  US 5      nU(       a  UR	                  U 5        Uc  M2  U(       a  M;  X#	 M?     g rr   )r  r  r  r   discard)rW   r  r  r  colsets        rX   dispose_ColumnMetrics.disposeo  sU    $$;;22CVVC&Ft$!&&G 3r[   c                    U R                   R                  nUR                  U5       H%  nUR                  [	        U/5      5      (       a  M%    g   gr  )r  r  r  r   r   )rW   
target_setexpanded_proxy_setts       rX   embedded_ColumnMetrics.embeddedz  sJ     "[[<<&&'9:A%22>1#3FGG ; r[   N)r  zColumnCollection[Any, _COL_co]r  r  )r  z=Union[Set[ColumnElement[Any]], FrozenSet[ColumnElement[Any]]]ry   r  )r]   r^   r_   r`   r   rz   r   r  r  r  rb   r\   r[   rX   r  r  [  sD    IO
&8
&?F
&/	



 

r[   r  c                  x   \ rS rSr% SrSrS\S'   S\S'   S\S	'   S
\S'    S3 S4S jjr\R                  " S5      S5S j5       r
    S6S jr\S7S j5       rS8S jrS7S jrS9S jrS:S jrS;S jrS<S jr\S=S j5       r\    S>S j5       r\    S?S j5       r    S@S jrSAS jrSBS jrSCS jrSDS jr\S3SES  jj5       r\SFS! j5       r S3     SGS" jjrSHS# jrSIS$ jrSJS% jrSKS& jrSLS' jrSMS( jr SNS) jr!Sr"    S6S* jr# S3     SOS+ jjr$SPS, jr%SQS- jr&SRS. jr'SSS/ jr(S0 r) ST     SUS1 jjr*S2r+g)VColumnCollectioni  ao  Collection of :class:`_expression.ColumnElement` instances,
typically for
:class:`_sql.FromClause` objects.

The :class:`_sql.ColumnCollection` object is most commonly available
as the :attr:`_schema.Table.c` or :attr:`_schema.Table.columns` collection
on the :class:`_schema.Table` object, introduced at
:ref:`metadata_tables_and_columns`.

The :class:`_expression.ColumnCollection` has both mapping- and sequence-
like behaviors. A :class:`_expression.ColumnCollection` usually stores
:class:`_schema.Column` objects, which are then accessible both via mapping
style access as well as attribute access style.

To access :class:`_schema.Column` objects using ordinary attribute-style
access, specify the name like any other object attribute, such as below
a column named ``employee_name`` is accessed::

    >>> employee_table.c.employee_name

To access columns that have names with special characters or spaces,
index-style access is used, such as below which illustrates a column named
``employee ' payment`` is accessed::

    >>> employee_table.c["employee ' payment"]

As the :class:`_sql.ColumnCollection` object provides a Python dictionary
interface, common dictionary method names like
:meth:`_sql.ColumnCollection.keys`, :meth:`_sql.ColumnCollection.values`,
and :meth:`_sql.ColumnCollection.items` are available, which means that
database columns that are keyed under these names also need to use indexed
access::

    >>> employee_table.c["values"]


The name for which a :class:`_schema.Column` would be present is normally
that of the :paramref:`_schema.Column.key` parameter.  In some contexts,
such as a :class:`_sql.Select` object that uses a label style set
using the :meth:`_sql.Select.set_label_style` method, a column of a certain
key may instead be represented under a particular label name such
as ``tablename_columnname``::

    >>> from sqlalchemy import select, column, table
    >>> from sqlalchemy import LABEL_STYLE_TABLENAME_PLUS_COL
    >>> t = table("t", column("c"))
    >>> stmt = select(t).set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL)
    >>> subq = stmt.subquery()
    >>> subq.c.t_c
    <sqlalchemy.sql.elements.ColumnClause at 0x7f59dcf04fa0; t_c>

:class:`.ColumnCollection` also indexes the columns in order and allows
them to be accessible by their integer position::

    >>> cc[0]
    Column('x', Integer(), table=None)
    >>> cc[1]
    Column('y', Integer(), table=None)

.. versionadded:: 1.4 :class:`_expression.ColumnCollection`
   allows integer-based
   index access to the collection.

Iterating the collection yields the column expressions in order::

    >>> list(cc)
    [Column('x', Integer(), table=None),
     Column('y', Integer(), table=None)]

The base :class:`_expression.ColumnCollection` object can store
duplicates, which can
mean either two columns with the same key, in which case the column
returned by key  access is **arbitrary**::

    >>> x1, x2 = Column("x", Integer), Column("x", Integer)
    >>> cc = ColumnCollection(columns=[(x1.name, x1), (x2.name, x2)])
    >>> list(cc)
    [Column('x', Integer(), table=None),
     Column('x', Integer(), table=None)]
    >>> cc["x"] is x1
    False
    >>> cc["x"] is x2
    True

Or it can also mean the same column multiple times.   These cases are
supported as :class:`_expression.ColumnCollection`
is used to represent the columns in
a SELECT statement which may include duplicates.

A special subclass :class:`.DedupeColumnCollection` exists which instead
maintains SQLAlchemy's older behavior of not allowing duplicates; this
collection is used for schema level objects like :class:`_schema.Table`
and
:class:`.PrimaryKeyConstraint` where this deduping is helpful.  The
:class:`.DedupeColumnCollection` class also has additional mutation methods
as the schema constructs have more use cases that require removal and
replacement of columns.

.. versionchanged:: 1.4 :class:`_expression.ColumnCollection`
   now stores duplicate
   column keys as well as the same column in multiple positions.  The
   :class:`.DedupeColumnCollection` class is added to maintain the
   former behavior in those cases where deduplication as well as
   additional replace/remove operations are needed.


)_collection_index_colsetr  z6List[Tuple[_COLKEY, _COL_co, _ColumnMetrics[_COL_co]]]r  z4Dict[Union[None, str, int], Tuple[_COLKEY, _COL_co]]r  z6Dict[ColumnElement[Any], Set[_ColumnMetrics[_COL_co]]]r  zSet[_COL_co]r  Nc                B   [         R                  U S[        5       5        [         R                  U S0 5        [         R                  U S[        R                  " [
        R                  5      5        [         R                  U S/ 5        U(       a  U R                  U5        g g )Nr  r  r  r  )r   r  r   collectionsdefaultdictr*   
OrderedSet_initial_populate)rW   r  s     rX   r   ColumnCollection.__init__  sx     	4CE242..+"9"9$//"J	
 	43""7+ r[   zsqlalchemy.sql.elementsc                    [         R                  R                  nUR                  " U R                  [
        R                  SS.6$ )NF)_literal_as_text_rolero  )r*   rK  sql_elementsr9   _all_columnsr   ColumnsClauseRolerW   r2   s     rX   __clause_element__#ColumnCollection.__clause_element__  s=    >>..""  #("9"9
 	
r[   c                &    U R                  U5        g rr   _populate_separate_keysrW   iter_s     rX   r  "ColumnCollection._initial_populate  s     	$$U+r[   c                P    U R                    VVs/ s H  u  poPM	     snn$ s  snnf rr   r  rW   r  r  s      rX   r  ColumnCollection._all_columns  s&    '+'7'78'7'7888   "c                R    U R                    VVs/ s H  u  n  o!PM
     snn$ s  snnf )zIReturn a sequence of string key names for all columns in this
collection.r  )rW   rq  r  s      rX   keysColumnCollection.keys  s*     $(#3#34#3iq!Q#3444s   #c                P    U R                    VVs/ s H  u  poPM	     snn$ s  snnf )zvReturn a sequence of :class:`_sql.ColumnClause` or
:class:`_schema.Column` objects for all columns in this
collection.r  r  s      rX   r,  ColumnCollection.values  s(     (,'7'78'7'7888r  c                Z    U R                    VVVs/ s H	  u  po1U4PM     snnn$ s  snnnf )zReturn a sequence of (key, column) tuples for all columns in this
collection each consisting of a string key name and a
:class:`_sql.ColumnClause` or
:class:`_schema.Column` object.
r  )rW   rq  r  r  s       rX   r  ColumnCollection.items%  s*     -1,<,<=,<[aaC,<===s   &c                ,    [        U R                  5      $ rr   )r  r  rV   s    rX   __bool__ColumnCollection.__bool__.  s    D$$%%r[   c                ,    [        U R                  5      $ rr   )r&  r  rV   s    rX   r-  ColumnCollection.__len__1  s    4##$$r[   c           	     b    [        U R                   VVs/ s H  u  poPM	     snn5      $ s  snnf rr   )r@  r  r  s      rX   r4  ColumnCollection.__iter__4  s+    $*:*:;*:YQQS*:;<<;s   +
c                    g rr   r\   r   s     rX   r  ColumnCollection.__getitem__8  s    <?r[   c                    g rr   r\   r   s     rX   r  r  ;       69r[   c                    g rr   r\   r   s     rX   r  r  @  r  r[   c                  ^   [        U[        [        45      (       aQ  [        U[        5      (       a  S T R                  U    5       nOU 4S jU 5       n[	        U5      R                  5       $ T R                  U   S   $ ! [         aA  n[        UR                  S   [        5      (       a  [        UR                  S   5      Uee S nAff = f)Nc              3  .   #    U  H  u  pnX4v   M     g 7frr   r\   )r(  sub_keyr  r  s       rX   r)  /ColumnCollection.__getitem__.<locals>.<genexpr>K  s      1F-W1 !1Fs   c              3  B   >#    U  H  nTR                   U   v   M     g 7frr   r  )r(  r  rW   s     rX   r)  r  P  s     DWDKK0s   r   r   )r  r  slicer  r  as_readonlyr  r  r   ry  
IndexError)rW   r   colsr  s   `   rX   r  r  E  s    	#u~..c5))151A1A#1FD
 EDD'-99;;{{3'** 	#((1+s++ !-36		s   A+B /B 
C<CCc                d     U R                   U   S   $ ! [         a  n[        U5      UeS nAff = f)Nr   )r  r  AttributeError)rW   r   r  s      rX   r   ColumnCollection.__getattr__[  s8    	/;;s#A&& 	/ %3.	/s    
/*/c                z    XR                   ;  a,  [        U[        5      (       d  [        R                  " S5      egg)Nz'__contains__ requires a string argumentFT)r  r  r   r)   r  r   s     rX   __contains__ColumnCollection.__contains__a  s7    kk!c3''''=  r[   c                8    [        X5       H  u  p#X#Ld  M    g   g)z\Compare this :class:`_expression.ColumnCollection` to another
based on the names of the keysFTr   )rW   r  lrs       rX   compareColumnCollection.comparek  s"      ,DAz - r[   c                $    U R                  U5      $ rr   )r  )rW   r  s     rX   r  ColumnCollection.__eq__u  s    ||E""r[   c                    g rr   r\   rW   r   rv   s      rX   r   ColumnCollection.getx  s    HKr[   c                    g rr   r\   r  s      rX   r   r  {  s    DGr[   c                H    XR                   ;   a  U R                   U   S   $ U$ )zGet a :class:`_sql.ColumnClause` or :class:`_schema.Column` object
based on a string key name from this
:class:`_expression.ColumnCollection`.r   r  r  s      rX   r   r  ~  s'     ++;;s#A&&Nr[   c                j    U R                   R                  < SSR                  S U  5       5      < S3$ )Nr  r  c              3  8   #    U  H  n[        U5      v   M     g 7frr   )r   )r(  r   s     rX   r)  +ColumnCollection.__str__.<locals>.<genexpr>  s     +dc!ffds   r  )r   r]   r  rV   s    rX   __str__ColumnCollection.__str__  s+    NN##II+d++
 	
r[   c                    [        5       err   r   rF  s      rX   r  ColumnCollection.__setitem__      !##r[   c                    [        5       err   r   r   s     rX   r"  ColumnCollection.__delitem__  r"  r[   c                    [        5       err   r   )rW   r   r   s      rX   r  ColumnCollection.__setattr__  r"  r[   c                    [        5       e)zIDictionary clear() is not implemented for
:class:`_sql.ColumnCollection`.r   rV   s    rX   clearColumnCollection.clear       "##r[   c                    [        5       err   r   )rW   r  s     rX   removeColumnCollection.remove  r"  r[   c                    [        5       e)zJDictionary update() is not implemented for
:class:`_sql.ColumnCollection`.r   r  s     rX   rb  ColumnCollection.update  r*  r[   c                   U VVs/ s H  u  p#X#[        X5      4PM     snn=U R                  SS& nU R                  R                  S U 5       5        U R                  R                  [        U5       VVVVs0 s H  u  nu  p#oeX#4_M     snnnn5        U R                  R                  [        U5       VVVs0 s H	  u  p'obX'4_M     snnn5        gs  snnf s  snnnnf s  snnnf )*populate from an iterator of (key, column)Nc              3  F   #    U  H  u  poR                  5       v   M     g 7frr   _deannotate)r(  r  r   s      rX   r)  ;ColumnCollection._populate_separate_keys.<locals>.<genexpr>  s     F:aMMOO:   !)r  r  r  rb  r  	enumeraterc  )rW   r  rq  r   r  idxr  r  s           rX   r  (ColumnCollection._populate_separate_keys  s     9>,
8=Q>$*+,
 	
j 	F:FF/8/DE/D^S)11&[/DE	
 	*9MN9MIAAxK9MNO,

 FNs   C9C:C"c                p   Uc  UR                   nOUn[        U R                  5      n[        [        U5      nU R                  R                  X5[        X5      45        U R                  R                  UR                  5       5        X54U R                  U'   X0R                  ;  a  X54U R                  U'   gg)a  Add a column to this :class:`_sql.ColumnCollection`.

.. note::

    This method is **not normally used by user-facing code**, as the
    :class:`_sql.ColumnCollection` is usually part of an existing
    object such as a :class:`_schema.Table`. To add a
    :class:`_schema.Column` to an existing :class:`_schema.Table`
    object, use the :meth:`_schema.Table.append_column` method.

N)r   r&  r  r	   r  appendr  r  r  r4  r  )rW   r  r   colkeyr  _columns         rX   r  ColumnCollection.add  s      ;ZZFF  !
 w'nT;<	
 	,,./ *A$#)"3DKK %r[   c                t    U R                    VVVs/ s H	  u  po1U4PM     snnnU R                  S.$ s  snnnf )Nr  r  r@  )rW   rq  r   r  s       rX   __getstate__ColumnCollection.__getstate__  s6    262B2BC2BwqQF2BCkk
 	
Cs   3c                   [         R                  U SUS   5        [         R                  U S[        R                  " [        R
                  5      5        [         R                  U SUS    VVs/ s H  u  p#X#[        X5      4PM     snn5        [         R                  U SU R                   VVVs1 s H  u  p$oTiM	     snnn5        g s  snnf s  snnnf )Nr  r  r  r  )r   r  r  r  r*   r  r  r  )rW   staterq  r   r  r  s         rX   __setstate__ColumnCollection.__setstate__  s    45?;.+"9"9$//"J	
 	 $M22FQ ~d./2	
 	)43C3CD3Ciaac3CD	
 Es   -C/Cc                z    XR                   ;  a,  [        U[        5      (       a  [        R                  " S5      egg)z3Checks if a column object exists in this collectionzZcontains_column cannot be used with string arguments. Use ``col_name in table.c`` instead.FT)r  r  r   r)   r  rW   r  s     rX   contains_column ColumnCollection.contains_column  s9    ll"#s##'';  r[   c                    [        U 5      $ )zAReturn a "read only" form of this
:class:`_sql.ColumnCollection`.)ReadOnlyColumnCollectionrV   s    rX   r  ColumnCollection.as_readonly  s     (--r[   c                    U R                   nU(       a  gU R                   H8  u    p#UR                  R                  nU H  nX   R	                  U5        M     M:     g)a  populate the "proxy index", if empty.

proxy index is added in 2.0 to provide more efficient operation
for the corresponding_column() method.

For reasons of both time to construct new .c collections as well as
memory conservation for large numbers of large .c collections, the
proxy_index is only filled if corresponding_column() is called. once
filled it stays that way, and new _ColumnMetrics objects created after
that point will populate it with new data. Note this case would be
unusual, if not nonexistent, as it means a .c collection is being
mutated after corresponding_column() were used, however it is tested in
test/base/test_utils.py.

N)r  r  r  r  r  )rW   r  r  metricsepsr  s         rX   _init_proxy_index"ColumnCollection._init_proxy_index  sP      !--MAq..44C(  .r[   c           
       ^ XR                   ;   a  U$ Su  p4UR                  nU R                  mT(       d  U R                  5         U4S jU 5        GHt  nU(       a  UR	                  U5      (       d  M#  Uc  UnM*  UR                  UR                  R                  5      nUc%  UR                  UR                  R                  5      n[        U5      [        U5      :  a  UnUnM  Xs:X  d  M  [        UR                  R                  5        Vs/ s H7  nUR                  U5      (       d  M  UR                  R                  SS5      PM9     sn5      n	[        UR                  R                  5        Vs/ s H7  nUR                  U5      (       d  M  UR                  R                  SS5      PM9     sn5      n
X:  d  GMp  UnUnGMw     U(       a  UR                  $ S$ s  snf s  snf )a*  Given a :class:`_expression.ColumnElement`, return the exported
:class:`_expression.ColumnElement` object from this
:class:`_expression.ColumnCollection`
which corresponds to that original :class:`_expression.ColumnElement`
via a common
ancestor column.

:param column: the target :class:`_expression.ColumnElement`
              to be matched.

:param require_embedded: only return corresponding columns for
 the given :class:`_expression.ColumnElement`, if the given
 :class:`_expression.ColumnElement`
 is actually present within a sub-element
 of this :class:`_expression.Selectable`.
 Normally the column will match if
 it merely shares a common ancestor with one of the exported
 columns of this :class:`_expression.Selectable`.

.. seealso::

    :meth:`_expression.Selectable.corresponding_column`
    - invokes this method
    against the collection returned by
    :attr:`_expression.Selectable.exported_columns`.

.. versionchanged:: 1.4 the implementation for ``corresponding_column``
   was moved onto the :class:`_expression.ColumnCollection` itself.

)NNc              3  N   >#    U  H  oT;   d  M
  TU     H  o"v   M     M     g 7frr   r\   )r(  tsmmr  s      rX   r)  8ColumnCollection.corresponding_column.<locals>.<genexpr>L  s&       
#2RxB"R&BB&Bs   	%%Nweightr   )r  r   r  rQ  r  r   r  r  r&  r+  _uncached_proxy_listshares_lineager+  r   )rW   r  require_embeddedselected_intersectionselected_metricsr  current_metricscurrent_intersectionscselected_col_distancecurrent_col_distancer  s              @rX   corresponding_column%ColumnCollection.corresponding_column  s   H \\!M2</%%
""$ 
# 
O $'?'?
'K'K#+'6$'1'>'>#**>>($ )0,6,C,C(//CC-) +,s3H/II (7$,@))B -0 !1 7 7 L L N !O !#  "008	 =BOO//!< N-) ,/ !0 6 6 K K M !N !#  "008	 =BOO//!< M,( ,C+:(0D-q 
t +;&&DD+s   G 
- G 
5G%
 G%
r\   rr   )r  z+Optional[Iterable[Tuple[_COLKEY, _COL_co]]])ry   r9   )r  z!Iterable[Tuple[_COLKEY, _COL_co]]ry   r   )ry   zList[_COL_co])ry   zList[_COLKEY])ry   zList[Tuple[_COLKEY, _COL_co]])ry   r  )ry   ry  )ry   zIterator[_COL_co])r   zUnion[str, int]ry   r  )r   zTuple[Union[str, int], ...]ry   *ReadOnlyColumnCollection[_COLKEY, _COL_co])r   r  ry   re  )r   z3Union[str, int, slice, Tuple[Union[str, int], ...]]ry   z:Union[ReadOnlyColumnCollection[_COLKEY, _COL_co], _COL_co])r   r   ry   r  )r   r   ry   r  )r  zColumnCollection[Any, Any]ry   r  )r  r   ry   r  )r   r   rv   r   ry   zOptional[_COL_co])r   r   rv   r  ry   zUnion[_COL_co, _COL])r   r   rv   zOptional[_COL]ry   zOptional[Union[_COL_co, _COL]]rx  )r   r   r  r   ry   r   )r   r   ry   r   )r   r   r   r   ry   r   )ry   r   )r  r   ry   r   )r  r   ry   r   )r  r  r   zOptional[_COLKEY]ry   r   )ry   rv  )rD  rv  ry   r   )r  r  ry   r  )ry   re  )F)r  r  r[  r  ry   zOptional[Union[_COL, _COL_co]]),r]   r^   r_   r`   r   r   rz   r   r*   preload_moduler  r  ry  r  r  r,  r  r  r-  r4  r   r  r   r  r  r  r   r  r  r"  r  r(  r,  rb  __hash__r  r  rA  rE  rI  r  rQ  rc  rb   r\   r[   rX   r  r    s   jX CIGG@@HH FJ
,B
, 
23
 4
,6,	,
 9 95
9>&%= ? ?9.9	39 9 99	39 9F	C,/# K KG G 37

!/
	'

$$$$
$$ HP6P	P DH"4("4/@"4	"4H

"
.)6 6;hEhE.2hE	'hE hEr[   r  	_NAMEDCOLzNamedColumn[Any]c                  |    \ rS rSrSr S     SS jjrSS jr    SS jrSS jrSS jr	 S     SS	 jjr
S
rg)DedupeColumnCollectioni  aY  A :class:`_expression.ColumnCollection`
that maintains deduplicating behavior.

This is useful by schema level objects such as :class:`_schema.Table` and
:class:`.PrimaryKeyConstraint`.    The collection includes more
sophisticated mutator methods as well to suit schema objects which
require mutable column collections.

.. versionadded:: 1.4

Nc                r   Ub&  UR                   U:w  a  [        R                  " S5      eUR                   nUc  [        R                  " S5      eX R                  ;   aI  U R                  U   S   nX1L a  g U R	                  U5        [
        R                  R                  US5        g U R                  X!5        g )NKDedupeColumnCollection requires columns be under the same key as their .keyz-Can't add unnamed column to column collectionr   r   )	r   r)   r  r  replacer*   rz  reset_append_new_column)rW   r  r   existings       rX   r  DedupeColumnCollection.add  s     ?vzzS0##-  jj;##?  ++{{3'*H!LL 
 ""((=##C0r[   c                   [        U R                  5      nU R                  R                  X[        X5      45        U R                  R                  UR                  5       5        X4U R                  U'   X4U R                  U'   g rr   )r&  r  r;  r  r  r  r4  r  )rW   r   named_columnr  s       rX   ro  )DedupeColumnCollection._append_new_column  sq      !t BC	
 	1134,A.Cr[   c           	        [        U5      n/ nU H  u  pEUR                  U:w  a  [        R                  " S5      eUR                  U R
                  ;   a-  UR                  UR                  :w  a  UR                  U5        Mr  UR                  U R
                  ;   a  UR                  U5        M  XE4U R
                  U'   U R                  R                  XE[        X5      45        M     U R                  R                  S U R                   5       5        U R
                  R                  S [        U R                  5       5       5        U H  nU R                  U5        M     g)r1  rl  c              3  F   #    U  H  u  po2R                  5       v   M     g 7frr   r3  )r(  rq  r   r  s       rX   r)  ADedupeColumnCollection._populate_separate_keys.<locals>.<genexpr>  s     N=M	qMMOO=Mr6  c              3  6   #    U  H  u  nu  p#oAX#44v   M     g 7frr   r\   )r(  r8  rq  r   r  s        rX   r)  rw    s       
0Knc9A!1&M0Ks   N)listr   r)   r  rU   r  r;  r  r  r  rb  r7  rm  )rW   r  r  replace_colrq  r  s         rX   r  .DedupeColumnCollection._populate_separate_keys  s    E{FAww!|''1  xx4;;&377chh+>""3'DKK'""3'"#A  ''1J(KL  	NT=M=MNN 
09$:J:J0K
 	
 CLL r[   c                4    U R                  S U 5       5        g )Nc              3  <   #    U  H  oR                   U4v   M     g 7frr   )r   )r(  r  s     rX   r)  0DedupeColumnCollection.extend.<locals>.<genexpr>  s     $Euggs^us   r  r  s     rX   extendDedupeColumnCollection.extend  s    $$$Eu$EEr[   c                r   XR                   ;  a  [        SU-  5      eU R                  UR                  	 U R                   R	                  U5        U R
                   VVVs/ s H  u  p#nX1Ld  M  X#U4PM     snnnU R
                  S S & U R                  R                  US5       H  nUR                  U 5        M     U R                  R                  [        U R
                  5       VVVVs0 s H  u  nu  p&ouX&4_M     snnnn5        U R                  [        U R
                  5      	 g s  snnnf s  snnnnf )Nz8Can't remove column %r; column is not in this collectionr\   )r  r  r  r   r,  r  r  r   r  rb  r7  r&  )rW   r  rq  r   rO  r8  r  r  s           rX   r,  DedupeColumnCollection.remove  s   %J  KK

#F# $(#3#3
#3w Q7O#3

 ((,,VR8GOOD! 9 	3<T=M=M3NO3N/sKQQ1(]3NO	
 KKD,,-.
 Ps    D*/D*,D1c                   U(       a  [        U5      nO
[        5       nUR                  U R                  ;   aa  UR                  UR                  :w  aG  U R                  UR                     S   nUR                  UR                  :X  a  UR	                  U5        UR                  U R                  ;   a+  UR	                  U R                  UR                     S   5        U(       d  U R                  UR                  U5        g/ nSnU R                   HR  u  pxn	X;   a4  U(       d+  SnUR                  UR                  U[        X5      45        M=  M?  UR                  XxU	45        MT     U(       aX  U R                  R                  U5        U H7  n
U R                  R                  U
S5       H  n	U	R                  U 5        M     M9     U(       d'  UR                  UR                  U[        X5      45        U R                  R	                  UR                  5       5        XPR                  SS& U R                  R                  5         U R                  R!                  [#        U R                  5       VVVVs0 s H  u  nu  pxoXx4_M     snnnn5        U R                  R!                  U R                   VVVs0 s H	  u  pxoXx4_M     snnn5        gs  snnnnf s  snnnf )a  add the given column to this collection, removing unaliased
versions of this column  as well as existing columns with the
same key.

e.g.::

    t = Table("sometable", metadata, Column("col1", Integer))
    t.columns.replace(Column("col1", Integer, key="columnone"))

will remove the original 'col1' from the collection, and add
the new column under the name 'columnname'.

Used by schema.Column to override columns during table reflection.

r   NFTr\   )r   rU   r  r   r  ro  r  r;  r  r  difference_updater  r   r  r4  r(  rb  r7  )rW   r  extra_remove
remove_colr  new_colsreplacedrq  r  rO  rcr8  r  s                rX   rm  DedupeColumnCollection.replace  s3   * \*JJ;;$++%&***CKK,Q/EzzUYY&u%::$NN4;;vzz2156##FJJ7KM#//OAG #HOOV^D-IJ    12  0 LL**:6 #0044R<GOOD)  = ! OOVZZ1MNO++-.&3<T=M=M3NO3N/sKQQ1(]3NO	
 	4;K;KL;KKQQxK;KLM PLs   5K7Kr\   rr   )r  rh  r   zOptional[str]ry   r   )r   r   rs  rh  ry   r   )r  zIterable[Tuple[str, _NAMEDCOL]]ry   r   )r  zIterable[_NAMEDCOL]ry   r   )r  rh  ry   r   )r  rh  r  zOptional[Iterable[_NAMEDCOL]]ry   r   )r]   r^   r_   r`   r   r  ro  r  r  r,  rm  rb   r\   r[   rX   rj  rj    s    
 7;11&31	1</4	8F/2 7;CNCN 4CN 
	CN CNr[   rj  c                  L    \ rS rSrSrS rS rS rSSS jjrSS jr	SS jr
S	rg
)rL  i;  _parentc                :   [         R                  U SU5        [         R                  U SUR                  5        [         R                  U SUR                  5        [         R                  U SUR                  5        [         R                  U SUR
                  5        g )Nr  r  r  r  r  )r   r  r  r  r  r  )rW   r  s     rX   r   !ReadOnlyColumnCollection.__init__@  st    4J74J,>,>?4:+<+<=4
0F0FG41H1HIr[   c                    SU R                   0$ Nr  r  rV   s    rX   rA  %ReadOnlyColumnCollection.__getstate__G  s    4<<((r[   c                0    US   nU R                  U5        g r  )r   )rW   rD  r  s      rX   rE  %ReadOnlyColumnCollection.__setstate__J  s    y!fr[   c                $    U R                  5         g rr   	_readonly)rW   r  r   s      rX   r  ReadOnlyColumnCollection.addN      r[   c                $    U R                  5         g rr   r  r  s     rX   r  ReadOnlyColumnCollection.extendQ  r  r[   c                $    U R                  5         g rr   r  )rW   items     rX   r,  ReadOnlyColumnCollection.removeT  r  r[   r\   N).)r  r   r   r   ry   r   )r2   r   ry   r   )r  r   ry   r   )r]   r^   r_   r`   r   r   rA  rE  r  r  r,  rb   r\   r[   rX   rL  rL  ;  s(     IJ)r[   rL  c                  ,    \ rS rSrS rS rS rS rSrg)	ColumnSetiX  c                
    X;   $ rr   r\   rH  s     rX   rI  ColumnSet.contains_columnY  s
    {r[   c                8    U H  nU R                  U5        M     g rr   )r  )rW   r  r  s      rX   r  ColumnSet.extend\  s    CHHSM r[   c                    / nU H7  nU  H.  nUR                  U5      (       d  M  UR                  X4:H  5        M0     M9     [        R                  " U6 $ rr   )rZ  r;  r2   and_)rW   r  r  r   r
  s        rX   r  ColumnSet.__eq__`  sK    A##E**HHQZ(   }}a  r[   c                8    [        [        S U  5       5      5      $ )Nc              3  $   #    U  H  ov   M     g 7frr   r\   )r(  r   s     rX   r)  %ColumnSet.__hash__.<locals>.<genexpr>i  s     *T!Ts   )hashr  rV   s    rX   rg  ColumnSet.__hash__h  s    E*T**++r[   r\   N)	r]   r^   r_   r`   rI  r  r  rg  rb   r\   r[   rX   r  r  X  s    !,r[   r  zColumnClause[Any]c                     [        [        U 5      R                  $ ! [         aM    [        R
                  " [        [        U 5      5       H#  n[        U5      (       d  M  UR                  s  s $    e f = f)zReturn the nearest .entity_namespace for the given entity.

If not immediately available, does an iterate to find a sub-element
that has one, if any.

)r	   r   r   r
  r   iterater%   r   )entityr  s     rX   _entity_namespacer  l  sd    '0AAA $$T*?%HID'--,,, J s    ?A3A3/A3c                     [        U 5      nU[        La  [        X1U5      $ [        X15      $ ! [         a%  n[        R
                  " SU < SU< S35      UeSnAff = f)zReturn an entry from an entity_namespace.


Raises :class:`_exc.InvalidRequestError` rather than attribute error
on not found.

zEntity namespace for "z" has no property ""N)r  ra   r  r
  r)   r   )r  r   rv   nsr  s        rX   _entity_namespace_keyr    s_    	v&& 2G,,2## %%@FL
	s   - 
- 
A AA)r   r   ry   zTypeGuard[_HasEntityNamespace])r2   zEUnion[ColumnElement[Any], FromClause, TextClause, _JoinTargetElement]ry   zIterator[FromClause])r2   z!Iterable[roles.ColumnsClauseRole]ry   rB   )r   ri   ry   ri   )r   r   r   r   ry   r  )r2   Iterable[_CLE]ry   r  )r   r  r   r  ry   z	Set[_CLE])r  1Union[_HasEntityNamespace, ExternallyTraversible]ry   r~   )r  r  r   r   rv   z%Union[SQLCoreOperations[Any], _NoArg]ry   r   )r   
__future__r   r  enumr   r   r   r   rl  r-   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   	cache_keyr    r!   
traversalsr"   r#   r$   r%   r&   r(   r)   r*   r+   r,   compat_typingutil.typingr.   r/   r0   r1   r2   r3   
_orm_typesr4   r5   _typingr6   r  r7   r8   r9   r:   r;   r<   r=   r>   schemar?   r@   
selectablerA   rB   rC   enginerD   rE   engine.interfacesrF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rR   ra   rd   rf   
_NONE_NAMErg   ri   r   _AmbiguousTableNameMaprk   r   _never_select_columnr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r7  rf  rR  rT  r|  r  r  r  typer  r  r  r'  StatementRoler  EventTargetr  	Visitabler  r  r  r  r  r  r  r  r  rh  rj  ReadOnlyContainerrL  r  r  r  r  r\   r[   rX   <module>r     s  
 #    !  	           !               " * ( # / + '    -  * "  #/6%'$&'%+$(.+&#%;3<.,5?+2:"IHH%T % 
I I
   
Te8CH-.'S1 
z 
4  **+BC Cx C8( 8
0
 	s# @	 < 		/		 3;LM %m,, %0: ???N8
nS#X. 8
v$nS#X. $@ *+1 ,1fC fCRi iX $ ?j ?54 5B[5 [5|@w @ ' $n'$$ n'b	8)) 8*');); 4M 4t j  )U49-s
3
)#74
Hv12)WW% )XEww/0 ED K'9:	lN-c9n= lN^,Wg-=>:, 34 ,(=, 6<=	 3 	r[   