o
    Rc*                     @   s\  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d Zdd Zdd Zdd Z			dzddZdd Zdd ZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZ G d&d' d'eZ!dej"ddfd(d)Z#G d*d+ d+eZ$G d,d- d-eZ%G d.d/ d/eZ&G d0d1 d1eZ'G d2d3 d3eZ(G d4d5 d5eZ)G d6d7 d7e!eZ*G d8d9 d9e*eZ+G d:d; d;eZ,G d<d= d=e%e!eZ-G d>d? d?e%e!eZ.G d@dA dAe%eZ/G dBdC dCe$eZ0G dDdE dEe eZ1G dFdG dGe%eZ2G dHdI dIe%e!eej3Z4G dJdK dKe4eZ5G dLdM dMe4eZ6G dNdO dOe eZ7G dPdQ dQeZ8G dRdS dSeeZ9G dTdU dUee%eZ:G dVdW dWee eZ;G dXdY dYe;Z<G dZd[ d[eZ=G d\d] d]e*Z>G d^d_ d_e'e%eZ?G d`da daeZ@G dbdc dce%eZAG ddde dee$eZBG dfdg dge@ZCG dhdi dieZDG djdk dkeZEG dldm dme'e$eZFG dndo doeFZGG dpdq dqeGZHG drds dse'e$eZIG dtdu due$eZJG dvdw dwe$eZKi ZLeMeD ]%ZNeOeeNZPeNQdxr*eNRdxdyZNeNeS v r*eS eN ePZTeTeLeP< qdS ){    N   )	operators)roles)visitors)ExecutableOption)Options)HasCacheKey)	Visitable   )exc)
inspection)util)collections_abcc                 C   s   t | ttjf o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)element r   :D:\Flask\env\Lib\site-packages\sqlalchemy/sql/coercions.py_is_literal    s   
r   c                 C   sr   t | tjrt | ts| D ]	}t|s dS qdS t | ttjtt	t
jjf o8t| d o8t | t p8t| 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   ZlanghelpersZ_symbolr   type
issubclass)r   elemr   r   r   r   /   s,   



r   c                 C   s   t | d||f S )Nz.. warning:: The %s argument to %s 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   Zadd_parameter_text)Z	paramnameZmeth_rstZ	param_rstr   r   r   _document_text_coercionU   s   r   c                 C   sP   |r&t |d tttfr&t|dkr&t |d tr"td| |f  |d S |S )Nr   r   zThe "%s" argument to %s(), 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)attrnameZfnnameargsr   r   r   !_expression_collection_was_a_listc   s   $r&   Fc                 K   s  | j rt|rt|drtj|| tjd
i ||dS t|  }|}t|tj	t
jt
jfsd }|jr;|j|fi |}nl|}d}	|jrOt|| rOt|drOd}	nt|drgd}	t|ddsa| }nnt|dsT|	s|jrtj|dd}
|
d ur|r||
j z|
 }W n ty   ||| Y nw |d u r|j|fd|i|}n|}n|}|d ur|js|jr|j|_|j|jjv r|jr|j|f||d	|}|S |j||fd|i|S )N__code__)apply_propagate_attrsFr   Tis_clause_element)Zraiseerrargname)r*   original_elementr   )allows_lambdacallabler   lambdasZLambdaElementZLambdaOptions_impl_lookupr   elementsZClauseElementr   Z
SchemaItemZFetchedValue_resolve_literal_only_literal_coercion$_skip_clauseelement_for_target_matchgetattrr   _use_inspectionr   inspectZ_post_inspectAttributeError_raise_for_expectedZ_propagate_attrs_role_class	__class____mro___post_coercion_implicit_coercions)roler   r(   r*   Zpost_inspectkwimplr+   resolvedr)   Zinspr   r   r   expectp   s   			


rB   c                 K   s   d|d< t | |fi |S )NTas_key)rB   )r>   r   r?   r   r   r   expect_as_key   s   rD   c                 c   sz    |D ]7}d }d }t | |}t|tjr| }}ng }t|i d|ji |r+|d }|d ur1|n|}||||fV  qd S )Ncolumnr   )rB   r   r   string_typesr   traverseappend)r>   ZexpressionsexprZstrnamerE   rA   colsZadd_elementr   r   r    expect_col_expression_collection   s   

rK   c                   @   sJ   e Zd ZdZdd ZdZdZdZdd Zddd	Z						dd
dZ
dS )RoleImpl)r9   namer5   c                 K   s   t  N)NotImplementedErrorselfr   r?   r   r   r   r2      s   zRoleImpl._literal_coercionNFc                 C   s    || _ |j| _t|tj| _d S rN   )r9   Z
_role_namerM   r   r   ZUsesInspectionr5   )rQ   Z
role_classr   r   r   __init__   s   zRoleImpl.__init__c                 K   s   |  ||| d S rN   r8   rQ   r   rA   r*   r?   r   r   r   r=      s   zRoleImpl._implicit_coercionsc           	      C   sv   |d ur||urd||f }nt |}|rd| j||f }nd| j|f }|r-|d| 7 }tjtj||d|d d S )Nz!%r object resolved from %r objectz$%s expected for argument %r; got %s.z%s expected, got %s. )codeZreplace_context)reprrM   r   raise_r   ArgumentError)	rQ   r   r*   rA   advicerV   errgotmsgr   r   r   r8     s   	zRoleImpl._raise_for_expectedrN   )NNNNN)__name__
__module____qualname__	__slots__r2   r<   r1   r3   rR   r=   r8   r   r   r   r   rL      s    
rL   c                   @      e Zd ZdZdd ZdS )_Deannotater   c                 K   s   ddl m} ||S )Nr   )_deep_deannotate)r   re   )rQ   rA   r?   re   r   r   r   r<   !  s   z_Deannotate._post_coercionNr_   r`   ra   rb   r<   r   r   r   r   rd         rd   c                   @   s   e Zd ZdZdZdS )_StringOnlyr   TN)r_   r`   ra   rb   r1   r   r   r   r   rh   '  s    rh   c                   @   $   e Zd ZdZ	dddZdd ZdS )_ReturnsStringKeyr   Nc                 K   "   t |tjr|S | ||| d S rN   r   r   rF   r8   rQ   r+   rA   r*   r?   r   r   r   r=   0     z%_ReturnsStringKey._implicit_coercionsc                 K      |S rN   r   rP   r   r   r   r2   8     z#_ReturnsStringKey._literal_coercionrN   r_   r`   ra   rb   r=   r2   r   r   r   r   rj   -  
    
rj   c                   @   s$   e Zd ZdZdd Z	dddZdS )_ColumnCoercionsr   c                 C   s   t d d S )Nz|implicitly coercing SELECT object to scalar subquery; please use the .scalar_subquery() method to produce a scalar subquery.)r   warn)rQ   r   r   r   "_warn_for_scalar_subquery_coercion?  s   z3_ColumnCoercions._warn_for_scalar_subquery_coercionNc                 K   s|   t |dds| ||| d S |jr|   | S |jr,t|tjr,|   |j	 S | j
jr5|jr5|S | ||| d S )Nr)   F)r4   r8   _is_select_statementru   scalar_subquery_is_from_clauser   
selectableZSubqueryr   r9   r,   _is_lambda_elementrm   r   r   r   r=   F  s   
z$_ColumnCoercions._implicit_coercionsrN   )r_   r`   ra   rb   ru   r=   r   r   r   r   rs   <  s
    rs   c                 C   sB   t j|dt | |rd|f nd|rd| ndd |d d S )Nzc%(extra)sTextual SQL expression %(expr)r %(argname)sshould be explicitly declared as text(%(expr)r)for argument %s z%s )rI   r*   extrarW   )r   rY   ellipses_string)r   r*   Zexc_clsr}   r\   r   r   r   _no_text_coercionY  s   	
r   c                   @      e Zd ZdZdddZdS )_NoTextCoercionr   Nc                 K   s8   t |tjrttj| jrt|| d S | || d S rN   )	r   r   rF   r   r0   
TextClauser9   r   r8   rQ   r   r*   r?   r   r   r   r2   m  s
   z!_NoTextCoercion._literal_coercionrN   r_   r`   ra   rb   r2   r   r   r   r   r   j      r   c                   @   s0   e Zd ZdZdZdZdZdddZdddZdS )	_CoerceLiteralsr   FNc                 C   
   t ||S rN   r   rQ   r   r*   r   r   r   _text_coercion|     
z_CoerceLiterals._text_coercionc                 K   s   t |tjr| jr|dkrtjdddS | j||fi |S | jr9|d u r)t S |du r1t	 S |du r9t
 S | jrKt |tjrKtjt|ddS | || d S )N*T)Z
is_literalF)r   r   rF   _coerce_starr0   ColumnClauser   _coerce_constsNullFalse_True__coerce_numericsnumbersNumberr   r8   r   r   r   r   r2     s   z!_CoerceLiterals._literal_coercionrN   )	r_   r`   ra   rb   r   r   r   r   r2   r   r   r   r   r   v  s    
r   c                   @   &   e Zd ZdZ	dddZdddZdS )	LiteralValueImplTNc                 K   s2   t |s| j|f||d| tjd ||ddS )N)rA   r*   Ttype_unique)r   r8   r0   BindParameter)rQ   r   rA   r*   r   r?   r   r   r   r=     s   z$LiteralValueImpl._implicit_coercionsc                 K   ro   rN   r   )rQ   r   r*   r   r?   r   r   r   r2     rp   z"LiteralValueImpl._literal_coercionrN   NN)r_   r`   ra   r1   r=   r2   r   r   r   r   r     s
    

r   c                       "   e Zd ZdZd fdd	Z  ZS )_SelectIsNotFromr   Nc                    s`   t |tjst |tjrd|d ur|jn|f }d}nd  }}tt| j|f||||d|S )NzETo create a FROM clause from a %s object, use the .subquery() method.Z89ve)r*   rA   r[   rV   )r   r   ZSelectStatementRoler:   superr   r8   )rQ   r   r*   rA   r?   r[   rV   r:   r   r   r8     s&   
z$_SelectIsNotFrom._raise_for_expectedr   r_   r`   ra   rb   r8   __classcell__r   r   r   r   r         r   c                   @   ri   )HasCacheKeyImplr   Nc                 K   rk   rN   )r   
traversalsr   r8   rm   r   r   r   r=     rn   z#HasCacheKeyImpl._implicit_coercionsc                 K   ro   rN   r   rP   r   r   r   r2     rp   z!HasCacheKeyImpl._literal_coercionrN   rq   r   r   r   r   r     rr   r   c                   @   ri   )ExecutableOptionImplr   Nc                 K   s    t |tr|S | ||| d S rN   )r   r   r8   rm   r   r   r   r=     s   
z(ExecutableOptionImpl._implicit_coercionsc                 K   ro   rN   r   rP   r   r   r   r2     rp   z&ExecutableOptionImpl._literal_coercionrN   rq   r   r   r   r   r     rr   r   c                       s.   e Zd ZdZ	dddZd	 fdd	Z  ZS )
ExpressionElementImplr   NFc              
   K   sp   |d u r|s|d u s|j st S ztj|||d|dW S  tjy7 } z| j||d W Y d }~d S d }~ww )NT)r   Z_is_crudr\   )Zshould_evaluate_noner0   r   r   r   rZ   r8   )rQ   r   rM   r   r*   Zis_crudr?   r\   r   r   r   r2     s"   
z'ExpressionElementImpl._literal_coercionc                    s6   t |tjr	d}nd }tt| j|f|||d|S )Nz`To create a column expression from a FROM clause row as a whole, use the .table_valued() method.r*   rA   r[   )r   r   ZAnonymizedFromClauseRoler   r   r8   rQ   r   r*   rA   r?   r[   r   r   r   r8     s   
z)ExpressionElementImpl._raise_for_expected)NNNFr   )r_   r`   ra   rb   r2   r8   r   r   r   r   r   r     s
    
r   c                   @   r   )	BinaryElementImplr   Nc              
   K   sJ   z	|j |||dW S  tjy$ } z| j||d W Y d }~d S d }~ww )N)r   r   )_bind_paramr   rZ   r8   )rQ   r   rI   operatorbindparam_typer*   r?   r\   r   r   r   r2     s   z#BinaryElementImpl._literal_coercionc                 K   s,   |j jr|j js||d ur|n|j }|S rN   )r   Z_isnullZ_with_binary_element_type)rQ   rA   rI   r   r?   r   r   r   r<     s
   z BinaryElementImpl._post_coercionr   rN   )r_   r`   ra   rb   r2   r<   r   r   r   r   r     s
    
r   c                   @   s4   e Zd ZdZ	dddZdd Zdd Zd	d
 ZdS )InElementImplr   Nc                 K   sj   |j r,t|tjr|jjr| | | j|jfi |S | | | j| fi |S | 	||| d S rN   )
rx   r   ry   Aliasr   rv   _warn_for_implicit_coercionr<   selectr8   rm   r   r   r   r=     s   


z!InElementImpl._implicit_coercionsc                 C   s   t d|jj  d S )Nz_Coercing %s object into a select() for use in IN(); please pass a select() construct explicitly)r   rt   r:   r_   )rQ   r   r   r   r   r   *  s
   z)InElementImpl._warn_for_implicit_coercionc                    s   t |tjrRt |tjsRi t|}|D ]%}t|s/t |tjs*| j	|fi | q||< q|d u r9t
 |< qrJt
j fdd|D  S  j|ddS | j	|fi | d S )Nc                    s(   g | ]}|v r| n  |qS r   )r   ).0orI   Znon_literal_expressionsr   r   r   
<listcomp>B  s    

z3InElementImpl._literal_coercion.<locals>.<listcomp>T)	expanding)r   r   Iterabler   rF   r   r   r   ZColumnOperatorsr8   r0   r   
ClauseListr   )rQ   r   rI   r   r?   r   r   r   r   r2   1  s*   
	zInElementImpl._literal_coercionc                 K   sd   |j r| S t|tjrt|jdkrJ |j|dS t|tjr0|j	dd}d|_
||_|S |S )Nr   )ZagainstT)Zmaintain_key)rv   rw   r   r0   r   r"   ZclausesZ
self_groupr   Z_cloner   Z	expand_op)rQ   r   rI   r   r?   r   r   r   r<   O  s   zInElementImpl._post_coercionrN   )r_   r`   ra   rb   r=   r   r2   r<   r   r   r   r   r     s    
r   c                       s@   e Zd ZdZdZ	d fdd	Zd fdd	Zdd	d
Z  ZS )OnClauseImplr   TNFc                    s2   |r	t |tr	|S tt| j||f||d|S )N)r*   legacy)r   r   r   r   r=   rQ   r+   rA   r*   r   r?   r   r   r   r=   g  s   
z OnClauseImpl._implicit_coercionsc                    s.   |rt |trt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   )rQ   r   r*   r   r   r   r   r   u  s   zOnClauseImpl._text_coercionc                 K   s   t |tjr|S |S rN   )r   r   JoinTargetRole)rQ   rA   r+   r?   r   r   r   r<     s   zOnClauseImpl._post_coercionNFrN   )	r_   r`   ra   rb   r   r=   r   r<   r   r   r   r   r   r   b  s    r   c                   @      e Zd ZdZdZdddZdS )WhereHavingImplr   TNc                 C   r   rN   r   r   r   r   r   r     r   zWhereHavingImpl._text_coercionrN   r_   r`   ra   rb   r   r   r   r   r   r   r         r   c                   @   r   )StatementOptionImplr   TNc                 C   
   t |S rN   r0   r   r   r   r   r   r     r   z"StatementOptionImpl._text_coercionrN   r   r   r   r   r   r     r   r   c                   @      e Zd ZdZdS )ColumnArgumentImplr   Nr_   r`   ra   rb   r   r   r   r   r         r   c                   @   r   )ColumnArgumentOrKeyImplr   Nr   r   r   r   r   r     r   r   c                   @   r   )StrAsPlainColumnImplr   Nc                 C   r   rN   )r0   r   r   r   r   r   r     r   z#StrAsPlainColumnImpl._text_coercionrN   )r_   r`   ra   rb   r   r   r   r   r   r     r   r   c                   @   r   )ByOfImplr   TNc                 C   r   rN   )r0   Z_textual_label_referencer   r   r   r   r     r   zByOfImpl._text_coercionrN   r   r   r   r   r   r         r   c                   @   rc   )OrderByImplr   c                 K   s$   t || jr|jd urt|S |S rN   )r   r9   Z_order_by_label_elementr0   Z_label_reference)rQ   rA   r?   r   r   r   r<     s   

zOrderByImpl._post_coercionNrf   r   r   r   r   r     rg   r   c                   @      e Zd ZdZ	dddZdS )GroupByImplr   Nc                 K   s   t |tjrtj|j S |S rN   )r   r   ZStrictFromClauseRoler0   r   crm   r   r   r   r=     s   zGroupByImpl._implicit_coercionsrN   r_   r`   ra   rb   r=   r   r   r   r   r         r   c                   @   s   e Zd ZdZdddZdS )DMLColumnImplr   Fc                 K   s   |r|j S |S rN   )key)rQ   r   rC   r?   r   r   r   r<     s   zDMLColumnImpl._post_coercionNFrf   r   r   r   r   r     r   r   c                   @   r   )ConstExprImplr   Nc                 K   s@   |d u rt  S |du rt  S |du rt  S | || d S NFT)r0   r   r   r   r8   r   r   r   r   r2     s   zConstExprImpl._literal_coercionrN   r   r   r   r   r   r     r   r   c                   @   s&   e Zd ZdZ	dddZdddZdS )TruncatedLabelImplr   Nc                 K   s"   t |tjr|S | ||| d S rN   rl   rm   r   r   r   r=     rn   z&TruncatedLabelImpl._implicit_coercionsc                 K   s   t |tjr|S t|S )zcoerce the given value to :class:`._truncated_label`.

        Existing :class:`._truncated_label` and
        :class:`._anonymous_label` objects are passed
        unchanged.
        )r   r0   Z_truncated_labelr   r   r   r   r2     s   
z$TruncatedLabelImpl._literal_coercionrN   rq   r   r   r   r   r     s
    
r   c                   @   r   )DDLExpressionImplr   TNc                 C   r   rN   r   r   r   r   r   r     s   
z DDLExpressionImpl._text_coercionrN   r   r   r   r   r   r     r   r   c                   @   r   )DDLConstraintColumnImplr   Nr   r   r   r   r   r     r   r   c                   @   r   )DDLReferredColumnImplr   Nr   r   r   r   r   r     r   r   c                   @   s"   e Zd ZdZdddZdd ZdS )LimitOffsetImplr   Nc                 K   s   |d u rd S |  ||| d S rN   rS   rT   r   r   r   r=     s   z#LimitOffsetImpl._implicit_coercionsc                 K   s(   |d u rd S t |}tj|||ddS )NTr   )r   Zasintry   Z_OffsetLimitParam)rQ   r   rM   r   r?   valuer   r   r   r2      s   
z!LimitOffsetImpl._literal_coercionrN   rq   r   r   r   r   r     s    
r   c                       s$   e Zd ZdZ	d fdd	Z  ZS )LabeledColumnExprImplr   Nc                    s\   t |tjr|d S tt| j||fd|i|}t |tjr%|d S | ||| d S Nr*   )r   r   ZExpressionElementRolelabelr   r   r=   r8   )rQ   r+   rA   r*   r?   newr   r   r   r=   -  s   


z)LabeledColumnExprImpl._implicit_coercionsrN   )r_   r`   ra   rb   r=   r   r   r   r   r   r   *  s    r   c                   @   s4   e Zd ZdZdZdZdZedej	Z
dddZdS )ColumnsClauseImplr   Tz^\w\S*$Nc                 C   sH   t |}| j| }tdt||rd|f nd|rdndd )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_columnrE   )rE   r*   r   )r   _guess_straight_columnmatchr   rZ   r   r~   )rQ   r   r*   Zguess_is_literalr   r   r   r   E  s   z ColumnsClauseImpl._text_coercionrN   )r_   r`   ra   rb   r   r   r   recompileIr   r   r   r   r   r   r   <  s    r   c                   @   r   )ReturnsRowsImplr   Nr   r   r   r   r   r   X  r   r   c                       s8   e Zd ZdZd	ddZ	d	 fdd	Zd	ddZ  ZS )
StatementImplr   Nc                 K   sJ   ||ur#t |tjs#z|j W |S  ty"   td| d Y |S w |S )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   rF   Z_execute_on_connectionr7   warn_deprecated)rQ   rA   r+   r*   r?   r   r   r   r<   _  s    
zStatementImpl._post_coercionc                    s(   |j r|S tt| j||fd|i|S r   )rz   r   r   r=   rm   r   r   r   r=   u  s   
z!StatementImpl._implicit_coercionsc                 C   s   t d t|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#   r0   r   r   r   r   r   r     s   
zStatementImpl._text_coercionrN   )r_   r`   ra   rb   r<   r=   r   r   r   r   r   r   r   \  s    

r   c                   @   r   )SelectStatementImplr   Nc                 K   s    |j r| S | ||| d S rN   )_is_text_clausecolumnsr8   rm   r   r   r   r=     s   z'SelectStatementImpl._implicit_coercionsrN   r   r   r   r   r   r     r   r   c                   @   r   )
HasCTEImplr   Nr   r   r   r   r   r     r   r   c                   @   r   )	IsCTEImplr   Nr   r   r   r   r   r     r   r   c                   @   s*   e Zd ZdZdZd	ddZ	d
ddZdS )JoinTargetImplr   TFc                 K   s   t |tr|S d S rN   )r   r   )rQ   r   r   r?   r   r   r   r2     s   
z JoinTargetImpl._literal_coercionNc                 K   sn   t |tjr|S |rt |trtd |S |r t |tjr |S |r.|jr.tjddd |S | 	||| d S )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.r   version)
r   r   r   r   r   r#   ZWhereHavingRolerv   r   r8   r   r   r   r   r=     s    
z"JoinTargetImpl._implicit_coercionsr   r   )r_   r`   ra   rb   r3   r2   r=   r   r   r   r   r     s    
r   c                   @   s*   e Zd ZdZ			d	ddZd
ddZdS )FromClauseImplr   NFTc                 K   sJ   |j r|r	| S |rtjddd |jS d S |jr|S | ||| d S Nr   r   r   )rv   Zsubqueryr   r   _implicit_subqueryr   r8   )rQ   r+   rA   r*   Zexplicit_subqueryallow_selectr?   r   r   r   r=     s   		z"FromClauseImpl._implicit_coercionsc                 K   s   |r|  S |S rN   )Z_deannotate)rQ   r   Z
deannotater?   r   r   r   r<     s   zFromClauseImpl._post_coercionr   r   )r_   r`   ra   rb   r=   r<   r   r   r   r   r     s    
r   c                   @   s   e Zd ZdZ		dddZdS )StrictFromClauseImplr   NFc                 K   s0   |j r|rtjddd |jS | ||| d S r   )rv   r   r   r   r8   )rQ   r+   rA   r*   r   r?   r   r   r   r=     s   
z(StrictFromClauseImpl._implicit_coercionsr   r   r   r   r   r   r     s
    r   c                   @   s   e Zd ZdZdddZdS )AnonymizedFromClauseImplr   FNc                 K   s   |d u sJ |j |dS )N)flat)Z_anonymous_fromclause)rQ   r   r   rM   r?   r   r   r   r<     s   z'AnonymizedFromClauseImpl._post_coercion)FNrf   r   r   r   r   r     r   r   c                   @   rc   )DMLTableImplr   c                 K   s   d|j v r
|j d S |S )NZ	dml_table)Z_annotationsrP   r   r   r   r<     s   

zDMLTableImpl._post_coercionNrf   r   r   r   r   r     rg   r   c                   @   r   )DMLSelectImplr   Nc                 K   s:   |j rt|tjr|jjr|jS | S | ||| d S rN   )rx   r   ry   r   r   rv   r   r8   rm   r   r   r   r=     s   
z!DMLSelectImpl._implicit_coercionsrN   r   r   r   r   r   r     r   r   c                       r   )CompoundElementImplr   Nc                    sB   t |tjr|jrd}nd}nd }tt| j|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   ZFromClauseRoleZ_is_subqueryr   r  r8   r   r   r   r   r8   -  s   
z'CompoundElementImpl._raise_for_expectedr   r   r   r   r   r   r  *  r   r  ZRoleZImpl)NNF)Ur   r   r|   r   r   r   baser   r   r   r   r	   r   r   r   r   r0   r.   r   ry   Zsqltypesr   r   r   r&   rB   rD   rK   objectrL   rd   rh   rj   rs   rZ   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ZByOfRoler   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r/   dirrM   r4   clsendswithreplaceglobalsr@   r   r   r   r   <module>   s   &
i/	

&K*		

-,$	

