
    +h                        d dl Z d dlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 dd	lmZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ dZdZdZdZdZdZ	d Zd Zd Zd Z	 	 	 dqdZd Zd Z G d de      Z G d de      Z G d de      Z G d de      Z  G d de      Z!dejD                  ddfd Z# G d! d"e      Z$ G d# d$e      Z% G d% d&e      Z& G d' d(e      Z' G d) d*e      Z( G d+ d,e      Z) G d- d.e!e      Z* G d/ d0e*e      Z+ G d1 d2e      Z, G d3 d4e%e!e      Z- G d5 d6e%e!e      Z. G d7 d8e%e      Z/ G d9 d:e$e      Z0 G d; d<e e      Z1 G d= d>e%e      Z2 G d? d@e%e!eejf                        Z4 G dA dBe4e      Z5 G dC dDe4e      Z6 G dE dFe e      Z7 G dG dHe      Z8 G dI dJee      Z9 G dK dLee%e      Z: G dM dNee e      Z; G dO dPe;      Z< G dQ dRe      Z= G dS dTe*      Z> G dU dVe'e%e      Z? G dW dXe      Z@ G dY dZe%e      ZA G d[ d\e$e      ZB G d] d^e@      ZC G d_ d`e      ZD G da dbe      ZE G dc dde'e$e      ZF G de dfeF      ZG G dg dheG      ZH G di dje'e$e      ZI G dk dle$e      ZJ G dm dne$e      ZKi ZL eMe      D ]N  ZN eOeeN      ZPeNj                  do      seNj                  dodp      ZNeN eS       v s:  eS       eN   eP      ZTeTeLeP<   P y)r    N   )	operators)roles)visitors)ExecutableOption)Options)HasCacheKey)	Visitable   )exc)
inspection)util)collections_abcc                 b    t        | t        t        j                  f       xr t	        | d       S )zhReturn whether or not the element is a "literal" in the context
    of a SQL expression construct.

    __clause_element__)
isinstancer
   schemaSchemaEventTargethasattr)elements    K/var/www/html/venv/lib/python3.12/site-packages/sqlalchemy/sql/coercions.py_is_literalr       s<     001
 	
 	7 !566    c                 r   t        | t        j                        r%t        | t              s| D ]  }t	        |      r y yt        | t
        t        j                  t        t        t        j                  j                  f       xr3 t        | d       xr$ t        | t               xs t        | t               S )a  Return whether or not the element is a "literal" in the context
    of a SQL expression construct.

    does a deeper more esoteric check than _is_literal.   is used
    for lambda elements that have to distinguish values that would
    be bound vs. not without any context.

    FTr   )r   r   Sequencestr_deep_is_literalr
   r   r   r	   r   r   langhelpers_symbolr   type
issubclass)r   elems     r   r   r   /   s     '?334Z>  	D#D)	  ((  ((	
 		
 	
 !566	
 7D)) 4g{33r   c                 <    t        j                  | d|d|d      S )Nz.. warning:: The z argument to z can be passed as a Python string argument, which will be treated as **trusted SQL text** and rendered as given.  **DO NOT PASS UNTRUSTED INPUT TO THIS PARAMETER**.)r   add_parameter_text)	paramnamemeth_rst	param_rsts      r   _document_text_coercionr(   U   s$    "" h	 
 
r   c                     |r`t        |d   t        t        t        f      rBt	        |      dk(  r4t        |d   t              rt        j                  d| d|d       |d   S |S )Nr   r   zThe "z" argument to zt(), when referring to a sequence of items, is now passed as a series of positional elements, rather than as a list. )r   listsetdictlenr   warn_deprecated_20)attrnamefnnameargss      r   !_expression_collection_was_a_listr2   c   s]    
47T3$563t9>d1gt$## 8@I
 Awr   c           	         | j                   rCt        |      r8t        |d      r,t        j	                  || t        j
                  d
i ||      S t        |    }|}t        |t        j                  t        j                  t        j                  t        j                  f      sd }|j                  r |j                  |fi |}n|}d}	|j                   rt        ||       rt        |d      rd}	n:t        |d      r.d}	t#        |dd      s|j%                         }nnt        |d      r.|	s\|j&                  r8t)        j*                  |d      }
|
|r|
j,                   	 |
j%                         }|H |j                  |fd|i|}n2|}n/t        |t        j                        r |j2                  d
i |}n|}|)|j4                  s|j4                  r|j4                  |_        |j6                  |j8                  j:                  v r$|j<                  r |j<                  |f||d	|}|S  |j>                  ||fd|i|S # t.        $ r |j1                  ||       Y w xY w)N__code__)apply_propagate_attrsFr   Tis_clause_element)raiseerrargname)r8   original_element ) allows_lambdacallabler   lambdasLambdaElementLambdaOptions_impl_lookupr   elementsClauseElementr   
SchemaItemFetchedValue	PyWrapper_resolve_literal_only_literal_coercion$_skip_clauseelement_for_target_matchgetattrr   _use_inspectionr   inspect_post_inspectAttributeError_raise_for_expected_sa__py_wrapper_literal_propagate_attrs_role_class	__class____mro___post_coercion_implicit_coercions)roler   r5   r8   post_inspectkwimplr9   resolvedr6   insps              r   expectr\   p   s    	
 WGZ($$!!'B'"7	 % 
 	
 D""		
 %%-t--g<<H  ' % 99w-G%9:$(!g';<(,%"7,?G")"<"<"> g';< %''%--gFD'' ..P'+'>'>'@H #5t55 )0 46 H #	GW..	/27228R8)%66%%191J1J.8--555*t**!1 	H 't''h
07
;=
 	
=  . P 445EwOPs    I IIc                 &    d|d<   t        | |fi |S )NTas_key)r\   )rV   r   rX   s      r   expect_as_keyr_      s    BxL$&2&&r   c              #      K   |D ]k  }d }d }t        | |      }t        |t        j                        r|x}}n,g }t	        j
                  |i d|j                  i       |r|d   }||n|}||||f m y w)Ncolumnr   )r\   r   r   string_typesr   traverseappend)rV   expressionsexprstrnamera   rZ   colsadd_elements           r    expect_col_expression_collectionrj      s      5$%h 1 12!%%GhDhXt{{,CDa & 2f445s   A2A4c                   B    e Zd ZdZd ZdZdZdZd ZddZ		 	 	 	 	 d	dZ
y)
RoleImpl)rQ   namerJ   c                     t               N)NotImplementedErrorselfr   rX   s      r   rG   zRoleImpl._literal_coercion   s    !##r   NFc                 r    || _         |j                  | _        t        |t        j
                        | _        y ro   )rQ   
_role_namerm   r!   r   UsesInspectionrJ   )rr   
role_classs     r   __init__zRoleImpl.__init__   s,    %))	)*e6J6JKr   c                 *    | j                  |||       y ro   rN   rr   r   rZ   r8   rX   s        r   rU   zRoleImpl._implicit_coercions  s      '8<r   c                     |||ur	|d|d}nt        |      }|r| j                  d|d|d}n| j                  d|d}|r|d|z   z  }t        j                  t	        j
                  ||      |	       y )
Nz object resolved from z objectz expected for argument z; got .z expected, got  )codereplace_context)reprrm   r   raise_r   ArgumentError)	rr   r   r8   rZ   advicer~   errgotmsgs	            r   rN   zRoleImpl._raise_for_expected  sw     HG$;9A7KCw-C		C -1IIs;C3<CC%%c5sKr   ro   )NNNNN)__name__
__module____qualname__	__slots__rG   rT   rF   rH   rw   rU   rN   r:   r   r   rl   rl      sA    :I$ N!+0(L
= Lr   rl   c                       e Zd ZdZd Zy)_Deannotater:   c                     ddl m}  ||      S )Nr   )_deep_deannotate)r   r   )rr   rZ   rX   r   s       r   rT   z_Deannotate._post_coercion(  s    *))r   Nr   r   r   r   rT   r:   r   r   r   r   %  s    I*r   r   c                       e Zd ZdZdZy)_StringOnlyr:   TN)r   r   r   r   rF   r:   r   r   r   r   .  s    I r   r   c                        e Zd ZdZ	 ddZd Zy)_ReturnsStringKeyr:   Nc                 b    t        |t        j                        r|S | j                  |||       y ro   r   r   rb   rN   rr   r9   rZ   r8   rX   s        r   rU   z%_ReturnsStringKey._implicit_coercions7  s.     &(9(9:##$$%5wIr   c                     |S ro   r:   rq   s      r   rG   z#_ReturnsStringKey._literal_coercion?      r   ro   r   r   r   r   rU   rG   r:   r   r   r   r   4      I 37Jr   r   c                        e Zd ZdZd Z	 ddZy)_ColumnCoercionsr:   c                 .    t        j                  d       y )Nz|implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.)r   warn)rr   s    r   "_warn_for_scalar_subquery_coercionz3_ColumnCoercions._warn_for_scalar_subquery_coercionF  s    			
r   Nc                    t        |dd      s| j                  |||       y |j                  r | j                          |j	                         S |j
                  rDt        |t        j                        r*| j                          |j                  j	                         S | j                  j                  r|j                  r|S | j                  |||       y )Nr6   F)rI   rN   _is_select_statementr   scalar_subquery_is_from_clauser   
selectableSubqueryr   rQ   r;   _is_lambda_elementr   s        r   rU   z$_ColumnCoercions._implicit_coercionsM  s     x!4e<$$%5wI**335++--%%*j))+
 335##3355++0K0KO$$%5wIr   ro   )r   r   r   r   r   rU   r:   r   r   r   r   C  s    I
 37Jr   r   c           	          t        j                   |dt        j                  |       |rd|nd|rd|z  nddz        |       y )Nzc%(extra)sTextual SQL expression %(expr)r %(argname)sshould be explicitly declared as text(%(expr)r)for argument  z%s )rf   r8   extrar   )r   r   ellipses_string)r   r8   exc_clsr   r   s        r   _no_text_coercionr   `  sQ     	KK4 ,,W5=D9"*/R	
 r   c                       e Zd ZdZddZy)_NoTextCoercionr:   Nc                     t        |t        j                        r1t        t        j
                  | j                        rt        ||       y | j                  ||       y ro   )	r   r   rb   r!   rA   
TextClauserQ   r   rN   rr   r   r8   rX   s       r   rG   z!_NoTextCoercion._literal_coerciont  sF    gt001j!1!17
 gw/$$Wg6r   ro   r   r   r   r   rG   r:   r   r   r   r   q  s    I7r   r   c                   ,    e Zd ZdZdZdZdZddZddZy)_CoerceLiteralsr:   FNc                     t        ||      S ro   r   rr   r   r8   s      r   _text_coercionz_CoerceLiterals._text_coercion       '22r   c                    t        |t        j                        r<| j                  r|dk(  rt        j                  dd      S  | j                  ||fi |S | j                  rF|t        j                         S |du rt        j                         S |du rt        j                         S | j                  r:t        |t        j                        r t        j                  t        |      d      S | j                  ||       y )N*T)
is_literalF)r   r   rb   _coerce_starrA   ColumnClauser   _coerce_constsNullFalse_True__coerce_numericsnumbersNumberr   rN   r   s       r   rG   z!_CoerceLiterals._literal_coercion  s    gt001  W^,,ST,BB*t**7GBrBB}}&E!((D~~''  Z'..%J((W$(GG  '2r   ro   )	r   r   r   r   r   r   r   r   rG   r:   r   r   r   r   }  s!    INL33r   r   c                   "    e Zd ZdZ	 ddZddZy)LiteralValueImplTNc                 v    t        |      s | j                  |f||d| t        j                  d ||d      S )N)rZ   r8   Ttype_unique)r   rN   rA   BindParameter)rr   r   rZ   r8   r   rX   s         r   rU   z$LiteralValueImpl._implicit_coercions  sM     8$$D$$"*G?A %%dG5%NNr   c                     |S ro   r:   )rr   r   r8   r   rX   s        r   rG   z"LiteralValueImpl._literal_coercion  r   r   ro   NN)r   r   r   rF   rU   rG   r:   r   r   r   r     s      15Or   r   c                   $     e Zd ZdZd fd	Z xZS )_SelectIsNotFromr:   c                     t        |t        j                        st        |t        j                        rd||j                  n|d}d}nd x}}t	        t
        |   |f||||d|S )NzTo create a FROM clause from a z$ object, use the .subquery() method.89ve)r8   rZ   r   r~   )r   r   SelectStatementRolerR   superr   rN   )rr   r   r8   rZ   rX   r   r~   rR   s          r   rN   z$_SelectIsNotFrom._raise_for_expected  s    gu889Ze//>
 *2)=8%%7JM 
 D  FT%t@

 
 	
r   r   r   r   r   r   rN   __classcell__rR   s   @r   r   r     s    I
 
r   r   c                        e Zd ZdZ	 ddZd Zy)HasCacheKeyImplr:   Nc                 b    t        |t        j                        r|S | j                  |||       y ro   )r   
traversalsr	   rN   r   s        r   rU   z#HasCacheKeyImpl._implicit_coercions  s.     &
(>(>?##$$%5wIr   c                     |S ro   r:   rq   s      r   rG   z!HasCacheKeyImpl._literal_coercion  r   r   ro   r   r:   r   r   r   r     r   r   r   c                        e Zd ZdZ	 ddZd Zy)ExecutableOptionImplr:   Nc                 N    t        |t              r|S | j                  |||       y ro   )r   r   rN   r   s        r   rU   z(ExecutableOptionImpl._implicit_coercions  s)     &(89##$$%5wIr   c                     |S ro   r:   rq   s      r   rG   z&ExecutableOptionImpl._literal_coercion  r   r   ro   r   r:   r   r   r   r     r   r   r   c                   .     e Zd ZdZ	 ddZd fd	Z xZS )ExpressionElementImplr:   c                     |$|s"||j                   st        j                         S 	 t        j                  |||d|      S # t        j
                  $ r}| j                  ||       Y d }~y d }~ww xY w)NT)r   _is_crudr   )should_evaluate_nonerA   r   r   r   r   rN   )rr   r   rm   r   r8   is_crudrX   r   s           r   rG   z'ExpressionElementImpl._literal_coercion  s}     Oe&@&@
 ==?";--'5 .   $$ ;((c(::;s   A A2A--A2c                 r    t        |t        j                        rd}nd }t        t        |   |f|||d|S )Nz`To create a column expression from a FROM clause row as a whole, use the .table_valued() method.r8   rZ   r   )r   r   AnonymizedFromClauseRoler   r   rN   rr   r   r8   rZ   rX   r   rR   s         r   rN   z)ExpressionElementImpl._raise_for_expected  sP    gu==>>  F*DE
$x
JL
 	
r   )NNNFr   )r   r   r   r   rG   rN   r   r   s   @r   r   r     s    I EJ;(
 
r   r   c                   "    e Zd ZdZ	 ddZddZy)BinaryElementImplr:   Nc                     	 |j                  |||      S # t        j                  $ r}| j                  ||       Y d }~y d }~ww xY w)N)r   r   )_bind_paramr   r   rN   )rr   r   rf   operatorbindparam_typer8   rX   r   s           r   rG   z#BinaryElementImpl._literal_coercion  sK    	7##Hg^#LL   	7$$W#$66	7s    AAAc                     |j                   j                  r5|j                   j                  s|j                  ||n|j                         }|S ro   )r    _isnull_with_binary_element_type)rr   rZ   rf   r   rX   s        r   rT   z BinaryElementImpl._post_coercion  s@    ==  ):):99"0"<$))H r   r   ro   )r   r   r   r   rG   rT   r:   r   r   r   r   
  s    I EI7r   r   c                   ,    e Zd ZdZ	 ddZd Zd Zd Zy)InElementImplr:   Nc                 b   |j                   rt        |t        j                        rD|j                  j
                  r.| j                  |        | j                  |j                  fi |S | j                  |        | j                  |j                         fi |S | j                  |||       y ro   )
r   r   r   Aliasr   r   _warn_for_implicit_coercionrT   selectrN   r   s        r   rU   z!InElementImpl._implicit_coercions!  s     ##8Z%5%56$$9900:*t**8+;+;BrBB00:*t**8??+<CCC$$%5wIr   c                 \    t        j                  d|j                  j                  z         y )Nz_Coercing %s object into a select() for use in IN(); please pass a select() construct explicitly)r   r   rR   r   )rr   r"   s     r   r   z)InElementImpl._warn_for_implicit_coercion1  s%    		:~~&&(	
r   c           	         t        |t        j                        rt        |t        j                        si }t        |      }|D ][  }t        |      s4t        |t        j                        s | j                  |fi | <|||<   B|Et        j                         ||<   ] |r9t        j                  |D cg c]  }||v r||   n|j                  ||       c} S |j                  ||d      S  | j                  |fi | y c c}w )NT)	expanding)r   r   Iterabler   rb   r*   r   r   ColumnOperatorsrN   rA   r   
ClauseListr   )rr   r   rf   r   rX   non_literal_expressionsos          r   rG   zInElementImpl._literal_coercion8  s!   g778T&&B
 ')#7mG A"1~%a)B)BC000?B?56/2Y19+A.A '**
 ")	   77 02!--h:;  '''T'JJ %D$$W33s   7"Dc                 B   |j                   r|j                         S t        |t        j                        r,t        |j                        dk(  rJ |j                  |      S t        |t        j                        r"|j                  d      }d|_
        ||_        |S |S )Nr   )againstT)maintain_key)r   r   r   rA   r  r-   clauses
self_groupr   _cloner   	expand_op)rr   r   rf   r   rX   s        r   rT   zInElementImpl._post_coercionV  s    '' **,,!4!457??+q000%%h%77!7!78nn$n7G $G (GNNr   ro   )r   r   r   r   rU   r   rG   rT   r:   r   r   r   r     s!    I 37J 
4<r   r   c                   >     e Zd ZdZdZ	 d fd	Zd fd	ZddZ xZS )OnClauseImplr:   Tc                 \    |rt        |t              r|S t        t        |   ||f||d|S )N)r8   legacy)r   r   r   r  rU   )rr   r9   rZ   r8   r  rX   rR   s         r   rU   z OnClauseImpl._implicit_coercionsn  sG     j3/Ot@   	
  r   c                 ~    |r't        |t              rt        j                  d       |S t        t
        |   ||      S )NUsing strings to indicate relationship names in Query.join() is deprecated and will be removed in SQLAlchemy 2.0.  Please use the class-bound attribute directly.)r   r   r   r.   r   r  r   )rr   r   r8   r  rR   s       r   r   zOnClauseImpl._text_coercion|  s=    j#.## N\47IIr   c                 >    t        |t        j                        r|S |S ro   )r   r   JoinTargetRole)rr   rZ   r9   rX   s       r   rT   zOnClauseImpl._post_coercion  s      &(<(<=##r   NFro   )	r   r   r   r   r   rU   r   rT   r   r   s   @r   r  r  i  s$    IN @E
Jr   r  c                       e Zd ZdZdZddZy)WhereHavingImplr:   TNc                     t        ||      S ro   r   r   s      r   r   zWhereHavingImpl._text_coercion  r   r   ro   r   r   r   r   r   r   r:   r   r   r  r    s    IN3r   r  c                       e Zd ZdZdZddZy)StatementOptionImplr:   TNc                 ,    t         j                  |      S ro   rA   r   r   s      r   r   z"StatementOptionImpl._text_coercion  s    ""7++r   ro   r  r:   r   r   r  r    s    IN,r   r  c                       e Zd ZdZy)ColumnArgumentImplr:   Nr   r   r   r   r:   r   r   r  r        Ir   r  c                       e Zd ZdZy)ColumnArgumentOrKeyImplr:   Nr  r:   r   r   r"  r"    r   r   r"  c                       e Zd ZdZddZy)StrAsPlainColumnImplr:   Nc                 ,    t         j                  |      S ro   )rA   r   r   s      r   r   z#StrAsPlainColumnImpl._text_coercion  s    $$W--r   ro   )r   r   r   r   r   r:   r   r   r$  r$    s    I.r   r$  c                       e Zd ZdZdZddZy)ByOfImplr:   TNc                 ,    t         j                  |      S ro   )rA   _textual_label_referencer   s      r   r   zByOfImpl._text_coercion  s    0099r   ro   r  r:   r   r   r'  r'    s    IN:r   r'  c                       e Zd ZdZd Zy)OrderByImplr:   c                 t    t        || j                        r!|j                  t        j	                  |      S |S ro   )r   rQ   _order_by_label_elementrA   _label_reference)rr   rZ   rX   s      r   rT   zOrderByImpl._post_coercion  s4    x!1!1200<,,X66Or   Nr   r:   r   r   r+  r+    s    Ir   r+  c                       e Zd ZdZ	 ddZy)GroupByImplr:   Nc                 r    t        |t        j                        rt        j                  |j
                   S |S ro   )r   r   StrictFromClauseRolerA   r  cr   s        r   rU   zGroupByImpl._implicit_coercions  s.     h : :;&&

33Or   ro   r   r   r   r   rU   r:   r   r   r0  r0    s    I 37r   r0  c                       e Zd ZdZddZy)DMLColumnImplr:   c                 "    |r|j                   S |S ro   )key)rr   r   r^   rX   s       r   rT   zDMLColumnImpl._post_coercion  s    ;;Nr   NFr   r:   r   r   r6  r6    s    Ir   r6  c                       e Zd ZdZddZy)ConstExprImplr:   Nc                     |t         j                         S |du rt         j                         S |du rt         j                         S | j	                  ||       y NFT)rA   r   r   r   rN   r   s       r   rG   zConstExprImpl._literal_coercion  sL    ?==?"??$$_>>##$$Wg6r   ro   r   r:   r   r   r;  r;    s    I7r   r;  c                   "    e Zd ZdZ	 ddZddZy)TruncatedLabelImplr:   Nc                 b    t        |t        j                        r|S | j                  |||       y ro   r   r   s        r   rU   z&TruncatedLabelImpl._implicit_coercions  s-     &(9(9:O$$%5wIr   c                 d    t        |t        j                        r|S t        j                  |      S )zcoerce the given value to :class:`._truncated_label`.

        Existing :class:`._truncated_label` and
        :class:`._anonymous_label` objects are passed
        unchanged.
        )r   rA   _truncated_labelr   s       r   rG   z$TruncatedLabelImpl._literal_coercion  s*     gx889N,,W55r   ro   r   r:   r   r   r?  r?    s    I 37J6r   r?  c                       e Zd ZdZdZddZy)DDLExpressionImplr:   TNc                 ,    t         j                  |      S ro   r  r   s      r   r   z DDLExpressionImpl._text_coercion  s    
 ""7++r   ro   r  r:   r   r   rD  rD    s    IN,r   rD  c                       e Zd ZdZy)DDLConstraintColumnImplr:   Nr  r:   r   r   rG  rG    r   r   rG  c                       e Zd ZdZy)DDLReferredColumnImplr:   Nr  r:   r   r   rI  rI    r   r   rI  c                       e Zd ZdZddZd Zy)LimitOffsetImplr:   Nc                 0    |y | j                  |||       y ro   ry   rz   s        r   rU   z#LimitOffsetImpl._implicit_coercions!  s    $$Wgx@r   c                 d    |y t        j                  |      }t        j                  |||d      S )NTr   )r   asintr   _OffsetLimitParam)rr   r   rm   r   rX   values         r   rG   z!LimitOffsetImpl._literal_coercion'  s9    ?JJw'E//e5 0  r   ro   r   r:   r   r   rK  rK    s    IAr   rK  c                   &     e Zd ZdZ	 d fd	Z xZS )LabeledColumnExprImplr:   c                    t        |t        j                        r|j                  d       S t	        t
        |   ||fd|i|}t        |t        j                        r|j                  d       S | j                  |||       y Nr8   )r   r   ExpressionElementRolelabelr   rR  rU   rN   )rr   r9   rZ   r8   rX   newrR   s         r   rU   z)LabeledColumnExprImpl._implicit_coercions4  s~     h ; ;<>>$''-tH (4;?AC #u::;yy&(()97HMr   ro   )r   r   r   r   rU   r   r   s   @r   rR  rR  1  s    I 37N Nr   rR  c                   ^    e Zd ZdZdZdZdZ ej                  dej                        Z
ddZy)ColumnsClauseImplr:   Tz^\w\S*$Nc                     t        |      }| j                  j                  |       }t        j                  dt        j                  |      |rd|nd|rdnddz        )NzTextual column expression %(column)r %(argname)sshould be explicitly declared with text(%(column)r), or use %(literal_column)s(%(column)r) for more specificityr   r   literal_columnra   )ra   r8   r[  )r   _guess_straight_columnmatchr   r   r   r   )rr   r   r8   guess_is_literals       r   r   z ColumnsClauseImpl._text_coercionL  sl    g,#::@@II#
 ..w7=D9"# #3	

 	
r   ro   )r   r   r   r   r   r   r   recompileIr\  r   r:   r   r   rY  rY  C  s3    INL'RZZ
BDD9
r   rY  c                       e Zd ZdZy)ReturnsRowsImplr:   Nr  r:   r   r   rc  rc  _  r   r   rc  c                   6     e Zd ZdZddZ	 d fd	ZddZ xZS )StatementImplr:   c                     ||ur)t        |t        j                        s	 |j                   |S |S # t        $ r t        j
                  d|z  d       Y |S w xY w)Na  Object %r should not be used directly in a SQL statement context, such as passing to methods such as session.execute().  This usage will be disallowed in a future release.  Please use Core select() / update() / delete() etc. with Session.execute() and other statement execution methods.1.4)r   r   rb   _execute_on_connectionrM   warn_deprecated)rr   rZ   r9   r8   rX   s        r   rT   zStatementImpl._post_coercionf  sp    ++Jd//5

 77 x " 
$$ "22 	 
s   0 "AAc                 N    |j                   r|S t        t        |   ||fd|i|S rT  )r   r   re  rU   )rr   r9   rZ   r8   rX   rR   s        r   rU   z!StatementImpl._implicit_coercions|  s<     &&OA (4;?A r   c                 V    t        j                  d       t        j                  |      S )NzUsing plain strings to indicate SQL statements without using the text() construct is  deprecated and will be removed in version 2.0.  Ensure plain SQL statements are passed using the text() construct.)r   r.   rA   r   r   s      r   r   zStatementImpl._text_coercion  s)    D	
 ""7++r   ro   )r   r   r   r   rT   rU   r   r   r   s   @r   re  re  c  s    I. 37,r   re  c                       e Zd ZdZ	 ddZy)SelectStatementImplr:   Nc                 b    |j                   r|j                         S | j                  |||       y ro   )_is_text_clausecolumnsrN   r   s        r   rU   z'SelectStatementImpl._implicit_coercions  s/     ####%%$$%5wIr   ro   r4  r:   r   r   rm  rm    s    I 37Jr   rm  c                       e Zd ZdZy)
HasCTEImplr:   Nr  r:   r   r   rr  rr    r   r   rr  c                       e Zd ZdZy)	IsCTEImplr:   Nr  r:   r   r   rt  rt    r   r   rt  c                   &    e Zd ZdZdZddZ	 ddZy)JoinTargetImplr:   Tc                 (    t        |t              r|S y ro   )r   r   )rr   r   r  rX   s       r   rG   z JoinTargetImpl._literal_coercion  s    gs#N $r   Nc                 >   t        |t        j                        r|S |r't        |t              rt	        j
                  d       |S |rt        |t        j                        r|S |r%|j                  rt	        j                  dd       |S | j                  |||       y )Nr  Implicit coercion of SELECT and textual SELECT constructs into FROM clauses is deprecated; please call .subquery() on any Core select or ORM Query object in order to produce a subquery object.rg  version)
r   r   r  r   r   r.   WhereHavingRoler   ri  rN   )rr   r9   rZ   r8   r  rX   s         r   rU   z"JoinTargetImpl._implicit_coercions  s     &(<(<= $#
8S1## O
8U-B-BCO55  6  O$$%5wIr   r9  r  )r   r   r   r   rH   rG   rU   r:   r   r   rv  rv    s    I+/(
 @E Jr   rv  c                   &    e Zd ZdZ	 	 	 ddZddZy)FromClauseImplr:   Nc                     |j                   r8|r|j                         S |r#t        j                  dd       |j                  S y |j
                  r|S | j                  |||       y Nry  rg  rz  )r   subqueryr   ri  _implicit_subqueryro  rN   )rr   r9   rZ   r8   explicit_subqueryallow_selectrX   s          r   rU   z"FromClauseImpl._implicit_coercions  sp     (( ((**$$: "  222  %%O$$%5wIr   c                 *    |r|j                         S |S ro   )_deannotate)rr   r   
deannotaterX   s       r   rT   zFromClauseImpl._post_coercion  s    &&((Nr   r=  r9  )r   r   r   r   rU   rT   r:   r   r   r~  r~    s    I J4r   r~  c                       e Zd ZdZ	 	 ddZy)StrictFromClauseImplr:   Nc                     |j                   r%|r#t        j                  dd       |j                  S | j	                  |||       y r  )r   r   ri  r  rN   )rr   r9   rZ   r8   r  rX   s         r   rU   z(StrictFromClauseImpl._implicit_coercions  sH     ((\  #  ...$$%5wIr   r  r4  r:   r   r   r  r    s    I Jr   r  c                       e Zd ZdZddZy)AnonymizedFromClauseImplr:   Nc                 .    |J |j                  |      S )N)flat)_anonymous_fromclause)rr   r   r  rm   rX   s        r   rT   z'AnonymizedFromClauseImpl._post_coercion  s     ||,,$,77r   )FNr   r:   r   r   r  r    s    I8r   r  c                       e Zd ZdZd Zy)DMLTableImplr:   c                 @    d|j                   v r|j                   d   S |S )N	dml_table)_annotationsrq   s      r   rT   zDMLTableImpl._post_coercion  s&    '...''44Nr   Nr   r:   r   r   r  r    s    Ir   r  c                       e Zd ZdZ	 ddZy)DMLSelectImplr:   Nc                     |j                   rLt        |t        j                        r"|j                  j
                  r|j                  S |j                         S | j                  |||       y ro   )r   r   r   r   r   r   r   rN   r   s        r   rU   z!DMLSelectImpl._implicit_coercions"  sX     ##8Z%5%56$$99'''(($$%5wIr   ro   r4  r:   r   r   r  r    s    I 37Jr   r  c                   $     e Zd ZdZd fd	Z xZS )CompoundElementImplr:   c                     t        |t        j                        r|j                  rd}nd}nd }t	        t
        |   |f|||d|S )NzFUse the plain select() object without calling .subquery() or .alias().z9To SELECT from any FROM clause, use the .select() method.r   )r   r   FromClauseRole_is_subqueryr   r  rN   r   s         r   rN   z'CompoundElementImpl._raise_for_expected4  sd    gu334##7  P  F($C
$x
JL
 	
r   r   r   r   s   @r   r  r  1  s    I
 
r   r  RoleImpl)NNF)Ur   r_  r   r   r   r   baser   r   r   r	   r
   r   r   r   r   rA   r=   r   r   sqltypesr   r   r(   r2   r\   r_   rj   objectrl   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r"  r$  ByOfRoler'  r+  r0  r6  r;  r?  rD  rG  rI  rK  rR  rY  rc  re  rm  rr  rt  rv  r~  r  r  r  r  r  r@   dirrm   rI   clsendswithreplaceglobalsrY   r:   r   r   <module>r     sv    	    "  #     " 
	

#L
  m
`'
5",Lv ,L^*& *!& ! Jv J< 3#4#4Dd"	7f 	73f 3<x "
v 
4h 8 #
,h #
L-x (HH HV'?$4h 'T3o'7 3,/8 ,( / .?H .: 0(ENN :
(H 
	(H 	%x 7H 76h 62,_h ,k+<h 3 h &N1 N$
(/8 
8h *,OX *,Z	J/8 	J  )JX )JX!% !HJ> J083 8#_h JOX J$
/8 
*  J %D
%
C}}V||FF+79"79T?3'D $L%r   