
    mg2                       % 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rSSKrSSKJ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&J0r0  SS&K&J1r2  SS'K3J4r4  SS(K3J5r5  SS)K'J6r6  SS*K'J7r7  SS+K'J8r8  SS,K'J9r9  SS-K'J:r:  SS.K'J;r;  SS/K*J<r<  SS0K*J=r=  SS1K.J>r>  SS2K0J?r?  SS3K@JArA  SS4KBJCrC  SS5KBJDrD  S6S7K&JErE  S6S&K&J1r1  S6S8K1JFrF  S6S9KGJHrH  S6S:KGJIrI  S6S;KGJJrJ  \RH                  (       a  SS<KKJLrL  SS=K'JMrM  SS>K'JNrN  SS?KOJPrP  SS@KQJRrR  SSAKSJTrT  SSBKSJUrU  SSCKSJVrV  SSDK*JWrW  SSEK*JXrX  SSFK*JYrY  SSGK*JZrZ  SSHK*J[r[  SSIK+J\r\  SSJK.J]r]  SSKK/J^r^  SSLK/J_r_  SSMK/J`r`  SSNK/Jara  SSOK/Jbrb  SSPK/Jcrc  SSQK/Jdrd  SSRK/Jere  SSSK@Jfrf  S6STKgJhrh  S6SUKiJjrj  S6SVKiJkrk  S6SWKiJlrl  S6SXKiJmrm  S6SYKiJnrn  S6SZKiJoro  S6S[KiJprp  S6S\KiJqrq  S6S]KiJrrr  \S^\s4   rt1 S_kru\R                  " S`\R                  5      rx\R                  " Sa\R                  5      ry\z" SSb5       V s1 s H  n \s" U 5      iM     sn R                  Sc/5      r|\R                  " Sd\R                  5      r}\R                  " Sd\R                  5      r~\R                  " Se\R                  5      r\R                  " Sf\GR                   5      r\R                  " Sg\GR                   5      rShr\SiSjSkSlSmSn.r0 \,GR
                  So_\,GR                  Sp_\,GR                  Sq_\,GR                  Sr_\,GR                  Ss_\,GR                  St_\,GR                  Su_\,GR                  Sv_\,GR                  Sw_\,GR                  Sx_\,GR                  Sy_\,GR                   Sz_\,GR"                  S{_\,GR$                  S|_\,GR&                  S}_\,GR(                  S~_\,GR*                  S_0 \,GR,                  S_\,GR.                  S_\,GR0                  S_\,GR2                  S_\,GR4                  S_\,GR6                  S_\,GR8                  S_\,GR:                  S_\,GR<                  S_\,GR>                  S_\,GR@                  S_\,GRB                  S_\,GRD                  S_\,GRF                  S_\,GRH                  S_\,GRJ                  S_\,GRL                  S_E\,GRN                  S\,GRP                  S\,GRR                  S\,GRT                  S\,GRV                  S\,GRX                  S\,GRZ                  S0Er\+GR^                  S\+GR`                  S\+GRb                  S\+GRd                  S\+GRf                  S\+GRh                  S\+GRj                  S\+GRl                  S\+GRn                  S\+GRp                  S\+GRr                  S\+GRt                  S\+GRv                  S\+GRx                  S0rS\S'   SSSSSSSSSSSSSSSS.r\/GR                  GR                  S\/GR                  GR                  S\/GR                  GR                  S\/GR                  GR                  S\/GR                  GR                  S\/GR                  GR                  S0r " S S\5      r " S S\I5      rSrS\S'   SrS\S'   S6rS\S'   SrS\S'    " S S\J5      r " S S\SS9r " S S\5      r " S S\5      r " S S\5      r " S S\F5      r " S S\	5      r " S S\	5      r\" \5      u  rrrr " S S\GR                  " SSS/5      5      r " S S5      r " S S\1GR                  5      r " S S\-GR                  \   \*GR                  5      r " S S\-GR                  \   \*GR                  5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\I5      r " S S\I5      r " S S5      rgs  sn f )a]  Base SQL and DDL compiler implementations.

Classes provided include:

:class:`.compiler.SQLCompiler` - renders SQL
strings

:class:`.compiler.DDLCompiler` - renders DDL
(data definition language) strings

:class:`.compiler.GenericTypeCompiler` - renders
type specification strings.

To generate user-defined SQL strings, see
:doc:`/ext/compiler`.

    )annotationsN)IntEnum)perf_counter)Any)Callable)cast)ClassVar)Dict)	FrozenSet)Iterable)Iterator)List)Mapping)MutableMapping)
NamedTuple)NoReturn)Optional)Pattern)Sequence)Set)Tuple)Type)TYPE_CHECKING)Union   )base)	coercions)crud)elements)	functions)	operators)roles)schema)
selectable)sqltypes)util)is_column_element)is_dml)	_de_clone)_from_objects)
_NONE_NAME) _SentinelDefaultCharacterization)
Executable)NO_ARG)ClauseElement)quoted_name)Column)	TupleType)
TypeEngine)prefix_anon_map)	Visitable   )exc)FastIntFlag)Literal)Protocol)	TypedDict)_AnnotationDict)_AmbiguousTableNameMap)CompileState)CacheKey)ExecutableDDLElement)Insert)
UpdateBase)
ValuesBase)_truncated_label)BindParameter)ColumnClause)ColumnElement)Label)Function)Table)AliasedReturnsRows)CompoundSelectState)CTE)
FromClause)NamedFromClause)ReturnsRows)Select)SelectState)_BindProcessorType)CursorResultMetaData)_CoreSingleExecuteParams)_DBAPIAnyExecuteParams)_DBAPIMultiExecuteParams)_DBAPISingleExecuteParams)_ExecuteOptions)_GenericSetInputSizesType)_MutableCoreSingleExecuteParams)Dialect)SchemaTranslateMapTyperN   >^   asdoinisonortoallandanyascendfornewnotoffoldsetbothcaser   descelsefromfullintojoinleftlikenullonlysomethentrueuserwhenarraycheckcrossfalsegrantgroupilikeinnerlimitorderouterrighttableunionusingwherebinarycolumncreateexceptfreezehavingisnulloffsetselectuniqueanalyseanalyzebetweencollatedefaultforeignleadingnaturalnotnullplacingprimarysimilarverbosedistinctoverlapstrailing	initially	intersect	localtime	symmetric
asymmetric
constraint
deferrable
referencescurrent_datecurrent_rolecurrent_timecurrent_usersession_userauthorizationlocaltimestampcurrent_timestampz^[A-Z0-9_$]+$z^[A-Z0-9_ $]+$
   $z5^(?:RESTRICT|CASCADE|SET NULL|NO ACTION|SET DEFAULT)$z^(?:DEFERRED|IMMEDIATE)$z%(?<![:\w\$\x5c]):([\w\$]+)(?![:\w\$])z\x5c(:[\w\$]*)(?![:\w\$])z%%(%(name)s)s?z%%sz:[_POSITION]z$[_POSITION]z	:%(name)s)pyformatqmarkformatnumericnumeric_dollarnamed AND z OR z + z * z -  % -z < z <= z != z > z >= z = z IS DISTINCT FROM z IS NOT DISTINCT FROM z || z MATCH z NOT MATCH z IN z NOT IN ,  FROM  AS  IS z IS NOT z	 COLLATE zEXISTS 	DISTINCT zNOT zANY zALL z DESCz ASCz NULLS FIRSTz NULLS LASTz ^ z | z & ~z << z >> coalesceCURRENT_DATECURRENT_TIMECURRENT_TIMESTAMPCURRENT_USER	LOCALTIMELOCALTIMESTAMPrandomsysdateSESSION_USERUSERCUBEROLLUPzGROUPING SETSzDict[Type[Function[Any]], str]	FUNCTIONSmonthdayyearsecondhourdoyminutequarterdowweekepochmillisecondsmicrosecondstimezone_hourtimezone_minute)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   UNIONz	UNION ALLEXCEPTz
EXCEPT ALL	INTERSECTzINTERSECT ALLc                  H    \ rS rSr% SrS\S'    S\S'    S\S'    S\S	'   S
rg)ResultColumnsEntryi[  zTracks a column expression that is expected to be represented
in the result rows for this statement.

This normally refers to the columns clause of a SELECT statement
but may also refer to a RETURNING clause, as well as for dialect-specific
emulations.

strkeynamenameTuple[Any, ...]objectsTypeEngine[Any]type N__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r       _/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/sqlalchemy/sql/compiler.pyr   r   [  s1     L;
I% r   r   c                  2    \ rS rSr          SS jrSrg)_ResultMapAppenderiz  c                    g Nr   selfr   r   r   type_s        r   __call___ResultMapAppender.__call__{  s     r   r   N)
r   r   r   r   r   zSequence[Any]r  r   returnNoner   r   r   r   r  r   r   r   r   r  r  z  s7      	
  
r   r  z
Literal[0]RM_RENDERED_NAMEz
Literal[1]RM_NAMEz
Literal[2]
RM_OBJECTS   z
Literal[3]RM_TYPEc                  4    \ rS rSr% S\S'   S\S'   S\S'   Srg)	_BaseCompilerStackEntryi  zSet[FromClause]asfrom_fromscorrelate_fromsrP   r$   r   Nr   r   r   r   r   r   r   r   r   r  r    s    !!$$r   r  c                  H    \ rS rSr% S\S'   S\S'   S\S'   S\S'   S	\S
'   Srg)_CompilerStackEntryi  r>   compile_stateboolneed_result_map_for_nestedneed_result_map_for_compoundrP   select_0Select[Any]insert_from_selectr   Nr  r   r   r   r  r    s      $$"&&##r   r  F)totalc                  ~    \ rS rSr% SrS\S'    S\S'    S\S'    S	\S
'    S\S'    \SS j5       r\SS j5       rSr	g)ExpandedStatei  a  represents state to use when producing "expanded" and
"post compile" bound parameters for a statement.

"expanded" parameters are parameters that are generated at
statement execution time to suit a number of parameters passed, the most
prominent example being the individual elements inside of an IN expression.

"post compile" parameters are parameters where the SQL literal value
will be rendered into the SQL statement at execution time, rather than
being passed as separate parameters to the driver.

To create an :class:`.ExpandedState` instance, use the
:meth:`.SQLCompiler.construct_expanded_state` method on any
:class:`.SQLCompiler` instance.

r   	statementrU   
parameters%Mapping[str, _BindProcessorType[Any]]
processorsOptional[Sequence[str]]positiontupzMapping[str, List[str]]parameter_expansionc                   ^  T R                   c  [        R                  " S5      e[        U 4S jT R                    5       5      $ )zbTuple of positional parameters, for statements that were compiled
using a positional paramstyle.

z.statement does not use a positional paramstylec              3  B   >#    U  H  nTR                   U   v   M     g 7fr  r$  ).0keyr  s     r   	<genexpr>6ExpandedState.positional_parameters.<locals>.<genexpr>  s     F5EcT__S)5Es   )r(  r7   InvalidRequestErrortupler  s   `r   positional_parameters#ExpandedState.positional_parameters  s@     #))@  FT5E5EFFFr   c                    U R                   $ )z.synonym for :attr:`.ExpandedState.parameters`.r,  r3  s    r   additional_parameters#ExpandedState.additional_parameters  s     r   r   N)r
  r   )r
  rU   )
r   r   r   r   r   r   propertyr4  r7  r   r   r   r   r"  r"    si    " N=(( 65+(( 10 	G 	G  r   r"  c                      \ rS rSr% SrS\S'    S\S'    S\S'    S	\S
'    SrS\S'    SrS\S'    SrS\S'    Sr	S	\S'    Sr
S\S'    SrS\S'    SrS\S'   Srg)_InsertManyValuesi  a  represents state to use for executing an "insertmanyvalues" statement.

The primary consumers of this object are the
:meth:`.SQLCompiler._deliver_insertmanyvalues_batches` and
:meth:`.DefaultDialect._deliver_insertmanyvalues_batches` methods.

.. versionadded:: 2.0

r  is_default_exprr   single_values_exprList[crud._CrudParamElementStr]insert_crud_paramsintnum_positional_params_countedFsort_by_parameter_orderincludes_upsert_behaviorsNOptional[Sequence[Column[Any]]]sentinel_columnsr   num_sentinel_columnsr'  sentinel_param_keysimplicit_sentinelembed_values_counterr   )r   r   r   r   r   r   rB  rC  rE  rF  rG  rH  rI  r   r   r   r   r;  r;    s     
  87M#&&
 %*T) ',t+ 9=5< !"#! 4807  $t#	 "'$&	r   r;  c                  ~    \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   S\S'   S\S'   S\S'   S\S'   S\S'   Srg)_InsertManyValuesBatchiN  aW  represents an individual batch SQL statement for insertmanyvalues.

This is passed through the
:meth:`.SQLCompiler._deliver_insertmanyvalues_batches` and
:meth:`.DefaultDialect._deliver_insertmanyvalues_batches` methods out
to the :class:`.Connection` within the
:meth:`.Connection._exec_insertmany_context` method.

.. versionadded:: 2.0.10

r   replaced_statementrV   replaced_parameters#Optional[_GenericSetInputSizesType]processed_setinputsizesz#Sequence[_DBAPISingleExecuteParams]batchzSequence[Tuple[Any, ...]]sentinel_valuesr@  current_batch_sizebatchnumtotal_batchesr  rows_sortedis_downgradedr   Nr   r   r   r   rK  rK  N  sD    
 //@@....Mr   rK  c                  J    \ rS rSrSrSrSrSrSr\\-  \-  r	\\	-  r
SrSrS	rg
)InsertmanyvaluesSentinelOptsig  z[bitflag enum indicating styles of PK defaults
which can work as implicit sentinel columns

r   r6            @   r   N)r   r   r   r   r   NOT_SUPPORTEDAUTOINCREMENTIDENTITYSEQUENCEANY_AUTOINCREMENT_SUPPORTED_OR_NOTUSE_INSERT_FROM_SELECTRENDER_SELECT_COL_CASTSr   r   r   r   rX  rX  g  sE    
 MMHH%08;%(99 r   rX  c                  $    \ rS rSrSr Sr SrSrg)CompilerStateiy  r   r   r6   r   N)r   r   r   r   	COMPILINGSTRING_APPLIEDNO_STATEMENTr   r   r   r   rf  rf  y  s     I=N Lr   rf  c                  4    \ rS rSrSrSr Sr Sr \\-  rSr	g)Lintingi  zrepresent preferences for the 'SQL linting' feature.

this feature currently includes support for flagging cartesian products
in SQL statements.

r   r   r6   r   N)
r   r   r   r   r   
NO_LINTINGCOLLECT_CARTESIAN_PRODUCTSWARN_LINTINGFROM_LINTINGr   r   r   r   rk  rk    s5     J!" L2-<Lr   rk  c                  ,    \ rS rSrSrSS jrSS jrSrg)	
FromLinteri  zGrepresents current state for the "cartesian product" detection
feature.Nc                  ^	 U R                   nU(       d  g[        U R                  5      n[        U5      nUb  UnUR                  U5        OUR	                  5       n[
        R                  " U/5      nU(       a~  U(       aw  UR                  5       m	UR                  T	5        U Vs1 s H  nT	U;   d  M  UiM     nnUR                  U	4S jU 5       5        UR                  U5        U(       a	  U(       a  Mw  U(       a  XE4$ gs  snf )NNNc              3  T   >#    U  H  oUR                  T5      (       +    v   M     g 7fr  )index)r-  edgenodes     r   r/  "FromLinter.lint.<locals>.<genexpr>  s      NIDdjj&6"67I   %()fromsro   edgesremovepopcollectionsdequepopleftdiscard
extendleftdifference_update)
r  startrz  r{  the_rest
start_withstackrv  	to_removerw  s
            @r   lintFromLinter.lint  s    

DJJu:JOOJ'!J!!:,/==?DT" +0@%$44<%I@ NINN##I.   '' As   '
D5Dc                   ^  T R                  5       u  p#U(       a\  UnU(       aR  SnSR                  U 4S jU 5       5      nUR                  UUT R                  U   S9n[        R
                  " U5        g g g )Nz{stmt_type} statement has a cartesian product between FROM element(s) {froms} and FROM element "{start}".  Apply join condition(s) between each element to resolve.r   c              3  J   >#    U  H  nS TR                   U    S 3v   M     g7f)"N)rz  )r-  from_r  s     r   r/  "FromLinter.warn.<locals>.<genexpr>  s'      &:?a

5)*!,%    #)	stmt_typerz  r  )r  rw   r   rz  r&   warn)r  r  r  r  rz  template	froms_strmessages   `       r   r  FromLinter.warn  s    #yy{ E7  !II &:?& 	 #//'#**Z0 *  		'"!  r   r   r  )SELECT)r   r   r   r   r   r  r  r   r   r   r   rq  rq    s    #J#r   rq  rz  r{  c                    ^  \ rS rSr% SrSrS\S'    SrS\S'    S	\S
'    SrSr	Sr
S\S'   SrS\S'   SrS\S'   \R                  rS\S'    S\S'   \R                  rS\S'   SrS\S'    SrS\S'    SrS\S'    S\S'    SS\R(                  " 5       4         S*S jjrS+U 4S  jjr\S! 5       rS" rS# r\S$ 5       rS,S% jrS-S& jr   S.       S/S' jjr\S( 5       r S)r!U =r"$ )0Compiledi  a  Represent a compiled SQL or DDL expression.

The ``__str__`` method of the ``Compiled`` object should produce
the actual text of the statement.  ``Compiled`` objects are
specific to their underlying database dialect, and also may
or may not be specific to the columns referenced within a
particular set of bind parameters.  In no case should the
``Compiled`` object be dependent on the actual values of those
bind parameters, even though it may reference those values as
defaults.
NOptional[ClauseElement]r#   r   stringrf  stateFzOptional[CursorResultMetaData]_cached_metadataz"Optional[List[ResultColumnsEntry]]_result_columns Optional[SchemaTranslateMapType]schema_translate_maprY   execution_optionsIdentifierPreparerpreparerr<   _annotationszOptional[CompileState]r  dml_compile_stateOptional[CacheKey]	cache_keyfloat	_gen_timec                   Xl         U R                   R                  U l        U(       a&  X0l        U R                  R	                  U5      U l        Ub  [
        R                  U l        X l        UR                  U l
        UR                  U l        U R                  (       a3  [        (       a  [        U[        5      (       d   eUR                  U l        U R"                  " U R                  40 UD6U l        U(       a+  U R                  R'                  U R$                  U5      U l        [
        R(                  U l        O[
        R*                  U l        [-        5       U l        g)a  Construct a new :class:`.Compiled` object.

:param dialect: :class:`.Dialect` to compile against.

:param statement: :class:`_expression.ClauseElement` to be compiled.

:param schema_translate_map: dictionary of schema names to be
 translated when forming the resultant SQL

 .. seealso::

    :ref:`schema_translating`

:param compile_kwargs: additional kwargs that will be
 passed to the initial call to :meth:`.Compiled.process`.


N)dialectidentifier_preparerr  r  _with_schema_translaterf  rg  r  r#  supports_executioncan_executer  r   
isinstancer-   _execution_optionsr  processr  _render_schema_translatesrh  ri  r   r  r  r  r#  r  render_schema_translatecompile_kwargss         r   __init__Compiled.__init__;  s   4 88(<% MM@@$DM  &00DJ&N(;;D ) 6 6D =%i<<<<)2)E)E&,,t~~HHDK&"mmEEKK!5 '55DJ&33DJ%r   c                @   > U R                  5         [        TU ]	  5       $ r  )_init_compiler_clssuper__init_subclass__)cls	__class__s    r   r  Compiled.__init_subclass__s  s     w(**r   c                    g r  r   r  s    r   r  Compiled._init_compiler_clsw  s    r   c                    U R                   (       a  UR                  XU5      $ [        R                  " U R                  5      er  )r  _execute_compiledr7   ObjectNotExecutableErrorr#  )r  
connectiondistilled_paramsr  s       r   _execute_on_connectionCompiled._execute_on_connection{  s=     //(9  ..t~~>>r   c                D    [         R                  " U [        U5      5      Uer  r7   UnsupportedCompilationErrorr   r  elementerrkws       r   visit_unsupported_compilation&Compiled.visit_unsupported_compilation  s    --dDMBKr   c                    [        5       e)zReturn a Compiled that is capable of processing SQL expressions.

If this compiler is one, it would likely just return 'self'.

NotImplementedErrorr3  s    r   sql_compilerCompiled.sql_compiler  s     "##r   c                (    UR                   " U 40 UD6$ r  _compiler_dispatch)r  objkwargss      r   r  Compiled.process  s    %%d5f55r   c                V    U R                   [        R                  L a  U R                  $ g)z3Return the string text of the generated SQL or DDL.r  )r  rf  rh  r  r3  s    r   __str__Compiled.__str__  s#     ::555;;r   c                    [        5       e)zReturn the bind params for this compiled object.

:param params: a dict of string/object pairs whose values will
               override bind values compiled in to the
               statement.
r  r  paramsextracted_parametersescape_namess       r   construct_paramsCompiled.construct_params  s     "##r   c                "    U R                  5       $ )z0Return the bind params for this compiled object.r  r3  s    r   r  Compiled.params  s     $$&&r   )
r  r  r  r  r  r  r  r  r#  r  )
r  r\   r#  r  r  r  r  r  r  Mapping[str, Any])r
  r  )r  r5   r  r   r
  r   )r
  r   NNTr  "Optional[_CoreSingleExecuteParams]r  &Optional[Sequence[BindParameter[Any]]]r  r  r
  z)Optional[_MutableCoreSingleExecuteParams])#r   r   r   r   r   r#  r   r  is_sqlis_ddlr  r  r  r&   
EMPTY_DICTr  r  r  r  r  immutabledictr  r  classmethodr  r  r  r9  r  r  r  r  r  r   __classcell__r  s   @r   r  r    s   
 *.I&-FC4-FF7;4;:>O7>=A:A)-8
 ! $(OOL/3,0M)0 15-4	 %)I!(	  BF(-,0,>,>,@6(6( +6( ?	6(
 "&6( *6(p+  ?L $ $6 6:GK!	$2$ E$ 	$
 
3$ ' 'r   r  c                  J    \ rS rSrSrSrS	S jrS
S jr        SS jrSr	g)TypeCompileri  z2Produces DDL specification for TypeEngine objects.z	visit_\w+c                    Xl         g r  r  )r  r  s     r   r  TypeCompiler.__init__  s    r   c                    UR                   (       aG  U R                  R                  UR                   ;   a#  UR                   U R                  R                     nUR                  " U 40 UD6$ r  )_variant_mappingr  r   r  r  r  r  s      r   r  TypeCompiler.process  sS    ""!!U%;%;;**4<<+<+<=E''333r   c                0    [         R                  " X5      Uer  )r7   r  r  s       r   r  *TypeCompiler.visit_unsupported_compilation  s     --d<#Er   r  N)r  r\   )r  r   r  r   r
  r   )r  r   r  	Exceptionr  r   r
  r   )
r   r   r   r   r   ensure_kwargr  r  r  r   r   r   r   r  r    s>    <L4FF!*F25F	Fr   r  c                  P    \ rS rSrSrSrSrSS jr\S 5       r	\S 5       r
S rS	rg
)_CompileLabeli  z;lightweight label object which acts as an expression.Label.labelr  r   
_alt_namesc                2    Xl         X l        U4U-   U l        g r  r  )r  colr   	alt_namess       r   r  _CompileLabel.__init__  s    	&9,r   c                .    U R                   R                  $ r  r  	proxy_setr3  s    r   r  _CompileLabel.proxy_set      ||%%%r   c                .    U R                   R                  $ r  r  r   r3  s    r   r   _CompileLabel.type      ||   r   c                    U $ r  r   r  r  s     r   
self_group_CompileLabel.self_group      r   )r	  r  r   N)r   )r   r   r   r   r   __visit_name__	__slots__r  r9  r  r   r  r   r   r   r   r  r    sD     FN/I-
 & & ! !r   r  c                  R    \ rS rSrSrSrSrS r\S 5       r	\S 5       r
S rS	 rS
rg)ilike_case_insensitivei  zproduce a wrapping element for a case-insensitive portion of
an ILIKE construct.

The construct usually renders the ``lower()`` function, but on
PostgreSQL will pass silently with the assumption that "ILIKE"
is being used.

.. versionadded:: 2.0

ilike_case_insensitive_operandr  
comparatorc                2    Xl         UR                  U l        g r  r!  )r  r  s     r   r  ilike_case_insensitive.__init__  s    !,,r   c                .    U R                   R                  $ r  r  r3  s    r   r   ilike_case_insensitive.proxy_set  r  r   c                .    U R                   R                  $ r  r  r3  s    r   r   ilike_case_insensitive.type  r  r   c                    U $ r  r   r  s     r   r  !ilike_case_insensitive.self_group   r  r   c                J    [        U R                  R                  U5      5      $ r  )r  r  _with_binary_element_type)r  r  s     r   r,  0ilike_case_insensitive._with_binary_element_type  s!    %LL2259
 	
r   )r"  r  N)r   r   r   r   r   r  r  r  r9  r  r   r  r,  r   r   r   r   r  r    sJ    	 6N'I- & & ! !
r   r  c                     \ rS rSr% Sr\r\R                  " SSSSSSSSS.5      r	S	\
S
'    S\
S'   S	\
S'   Sr\rSrS\
S'   SrS\
S'   SrS\
S'    S\
S'    SrS\
S'    SrS\
S'    SrS\
S'    SrS\
S'   S\
S'    S \
S!'    S"\
S#'    SrS\
S$'    SrS\
S%'    SrS\
S&'    S'\
S('    S'\
S)'    S'\
S*'    S+\
S,'    SrS\
S-'    SrS\
S.'    SrS\
S/'    SrS\
S0'    SrS\
S1'    SrS\
S2'    SrS3\
S4'    SrS5\
S6'    Sr S7\
S8'   Sr!S9\
S:'   Sr"S;\
S<'   \#" 5       r$S=\
S>'    \#" 5       r%S=\
S?'    \RL                  r'S@\
SA'    Sr( Sr) Sr*SB\
SC'    Sr+S7\
SD'    Sr,S7\
SE'   Sr-S7\
SF'   Sr.S\
SG'   SH\
SI'   SJ\
SK'   SL\
SM'   S\
SN'   \/R`                  " SO5      r1\/R`                  " SP5      r2\/R`                  " \2Rf                   SQ\1Rf                   35      r4\5SR 5       r6\5SS 5       r7SSS\8S4               GSSU jjr9\:GSSV j5       r;\Rx                  GS	SW j5       r=\:SX 5       r>\:SY 5       r?\:SZ 5       r@\R                  GS
S[ j5       rB\R                  GSS\ j5       rD\ER                  S] 5       rGS^ rHS_ rI\R                    GSS` j5       rJSa rK\:Sb 5       rL  GS     GSSc jjrM      GS             GSSd jjrN\R                  Se 5       rO\:Sf 5       rP GS     GSSg jjrQ\R                  " Sh5      Si 5       rSSj\
Sk'   \R                  GSSl j5       rT\R                  \R                  " Sm5      Sn 5       5       rU\R                  \R                  " Sm5      So 5       5       rVSp rWSq rXGSSr jrYSs rZ GSSt jr[ GSSu jr\     GSSv jr]Sw r^Sx r_    GS             GSSy jjr`Sz raS{ rbS| rcS} rdS~ reS rfGSS jrg GSS jrhS riS rjS rkS rlS rmS rnS roS rpS rqS rrS rsS rtS ruS rvS rwS rxS ry GS       GSS jjrzS r{S r|S r} GSS jr~S rS r GSS jrS rS rS rS rS rS rS rS r GSS jrS r    GSS jrS rS rS rS rS r GSS jrS rS r\R                  S 5       rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r     GSS jrS r\S4S jrS rS r      GSS jrGSS jr      GS                  GS!S jjrS rSSSSS\GRn                  " S5      4                 GS"S jjrS rS r        GS#S jrS rS rGSS jrS rGSS jrS rS r          GS$S jr GSS jr       GS%S jrS rS rS rS rS rS\
S'   \GR                  (       d"  \R                  " S\#" 5       4S\#" 5       4/5      r GSS jrSrST\
S'           GS&S jr    GS'S jrS rS rS r  GSS jrS rS rS rS rS r          GS(S jrS r   GS)S jr       GS*S jrGSS jrS r\R                  " \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  05      r\GR                  \GR                  \GR                  05      r    GS+S jr                GS,S jr GS-S jrS rS rS rS rGSS jrGS  rGS rGSGS jrGS rGS rGS rGSrg(.  SQLCompileri	  zvDefault implementation of :class:`.Compiled`.

Compiles :class:`_expression.ClauseElement` objects into SQL strings.

PAZC_)%():.[] zClassVar[Mapping[str, str]]bindname_escape_characterszClassVar[Pattern[str]]_bind_translate_re_bind_translate_charsTFr  isdeleteisinsertisupdatezOptional[List[Column[Any]]]	postfetchr   zSequence[Column[Any]]insert_prefetchupdate_prefetchN&Optional[Sequence[ColumnElement[Any]]]implicit_returningisplaintextzDict[str, BindParameter[Any]]bindszDict[BindParameter[Any], str]
bind_nameszList[_CompilerStackEntry]r  returning_precedes_values'render_table_with_column_in_update_fromansi_bind_rulesr   bindtemplatecompilation_bindtemplate_numeric_binds_identifier_charzList[ResultColumnsEntry]r  _textual_ordered_columns_ad_hoc_textual_ordered_columns_loose_column_name_matching_numeric_binds_render_postcompilezOptional[ExpandedState]_post_compile_expanded_stateOptional[str]_pre_expanded_stringOptional[List[str]]_pre_expanded_positiontupzOptional[_InsertManyValues]_insertmanyvaluesz!Optional[crud._CrudParamSequence]_insert_crud_paramszFrozenSet[BindParameter[Any]]literal_execute_paramspost_compile_paramszutil.immutabledict[str, str]escaped_bind_nameszbOptional[Tuple[Dict[BindParameter[Any], List[BindParameter[Any]]], Dict[str, BindParameter[Any]]]]_cache_key_bind_matchr(  _values_bindparam_visited_bindparaminlinez"Optional[MutableMapping[CTE, str]]cteszDict[Tuple[int, str], CTE]ctes_by_level_namez/Dict[CTE, Tuple[int, str, selectable._CTEOpts]]level_name_by_ctectes_recursivez"__\[POSTCOMPILE_(\S+?)(~~.+?~~)?\]z%\(([^)]+?)\)s|c                $    U R                  5         g r  )_init_bind_translater  s    r   r  SQLCompiler._init_compiler_cls2  s      "r   c                    [         R                  " SR                  U R                  5      5      n[         R                  " SU S35      U l        U R                  U l        g )Nr  r:  r;  )reescaperw   r=  compiler>  r?  )r  regs     r   rk   SQLCompiler._init_bind_translate6  sF    ii > >?@!#auAJ!7$'$B$B!r   r   c                   X@l         X0l        U(       a=  US    V	s0 s H  oR                  U	_M     n
n	US    V	s0 s H  oU	/_M     nn	X4U l        XPl        X`l        0 U l        [        R                  " 5       U l	        / U l
        / U l        UR                  U l        U R                  (       aN  UR                  R                  S5      =U l        nU(       a  UR                  S:X  a  SOSU l        ["        U l        O[&        UR                     U l        SU l        UR*                  =(       d    UR,                  U l        [/        5       U l        0 U l        0 U l        [6        R8                  " XU40 UD6  U R:                  (       d"  U R<                  (       d  U R>                  (       a  [@        (       a  [C        U[D        5      (       d   eU R:                  (       d  U R<                  (       a  [@        (       a  [C        U[F        5      (       d   eURH                  (       a  SU l%        OUU R                  (       aD  U R:                  (       a,  U RL                  RN                  (       a  URP                  (       a  SU l%        [&        UR                     U l)        U(       aP  U RT                  RW                  URT                  RY                  5        VVs0 s H  u  pUS;  d  M  X_M     snn5        U RZ                  [\        R^                  L av  U R                  (       a2  U R                  (       a  U Ra                  5         OU Rc                  5         U Rd                  (       a!  U Rg                  S	SS
9nU Ri                  USS9  gggs  sn	f s  sn	f s  snnf )a  Construct a new :class:`.SQLCompiler` object.

:param dialect: :class:`.Dialect` to be used

:param statement: :class:`_expression.ClauseElement` to be compiled

:param column_keys:  a list of column names to be compiled into an
 INSERT or UPDATE statement.

:param for_executemany: whether INSERT / UPDATE statements should
 expect that they are to be invoked in an "executemany" style,
 which may impact how the statement will be expected to return the
 values of defaults and autoincrement / sequences and similar.
 Depending on the backend and driver in use, support for retrieving
 these values may be disabled which means SQL expressions may
 be rendered inline, RETURNING may not be rendered, etc.

:param kwargs: additional keyword arguments to be consumed by the
 superclass.

r   r   r   r   r8  NT>   r  r  r  
positionalrN  rU  rO  Fr  _no_postcompile)_populate_self)5column_keysr  r.  ra  for_executemanylintingrI  r&   column_dictrJ  r  r  rt  
paramstyle
startswithrU  rP  _pyformat_templaterO  BIND_TEMPLATESre  label_lengthmax_identifier_lengthr4   anon_maptruncated_names_truncated_countersr  r  rA  rB  r@  r   r  rB   rC   _inlinerd  r  insert_executemany_returning_return_defaultsrN  __dict__updateitemsr  rf  rh  _process_numeric_process_positionalrV  r  #_process_parameters_for_postcompile)r  r  r#  r  rx  ry  rz  _supporting_againstr  bcksmckbmnbkvr$  s                   r   r  SQLCompiler.__init__<  s   @ '"&/l3lEE1HlD3$-aL1LqsFLD1*.D&
  / 
 **, 
! ",,??'.'9'9'D'DY'OOD""--1AACs 3 -?D),:7;M;M,ND)	   AG$A$A 	 () <>35 $=f===DMMT]]}!)Z8888}} =%i<<<<$$"&DK))AA%66 #'DK*7+=+=>MM   !4 < < B B D D	 AD D" ::555&&))+,,.''!22!&$( 3 

 88t 9  ( 6y 41Vs   M>NN
N
c                J    U R                   c  gU R                   R                  $ )a  When an INSERT is compiled with a single set of parameters inside
a VALUES expression, the string is assigned here, where it can be
used for insert batching schemes to rewrite the VALUES expression.

.. versionadded:: 1.3.8

.. versionchanged:: 2.0 This collection is no longer used by
   SQLAlchemy's built-in dialects, in favor of the currently
   internal ``_insertmanyvalues`` collection that is used only by
   :class:`.SQLCompiler`.

N)r\  r=  r3  s    r   insert_single_values_expr%SQLCompiler.insert_single_values_expr  s%     !!)))<<<r   c                   U R                   (       a  U R                   $ U R                  bS  [        U R                  5      (       a9  U R                  R                   Vs/ s H  n[	        U5      (       d  M  UPM     sn$ gs  snf )a  The effective "returning" columns for INSERT, UPDATE or DELETE.

This is either the so-called "implicit returning" columns which are
calculated by the compiler on the fly, or those present based on what's
present in ``self.statement._returning`` (expanded into individual
columns using the ``._all_selected_columns`` attribute) i.e. those set
explicitly using the :meth:`.UpdateBase.returning` method.

.. versionadded:: 2.0

N)rG  r#  r(   _all_selected_columnsr'   )r  cs     r   effective_returningSQLCompiler.effective_returning  so     ""***^^'F4>>,B,B ===A$Q' =  s   A?5A?c                    U R                   $ )zFbackwards compatibility; returns the
effective_returning collection.

)r  r3  s    r   	returningSQLCompiler.returning  s     '''r   c                d     U R                   S   S   $ ! [         a  n[        S5      UeSnAff = f)a  Return the current 'executable' that is being compiled.

This is currently the :class:`_sql.Select`, :class:`_sql.Insert`,
:class:`_sql.Update`, :class:`_sql.Delete`,
:class:`_sql.CompoundSelect` object that is being compiled.
Specifically it's assigned to the ``self.stack`` list of elements.

When a statement like the above is being compiled, it normally
is also assigned to the ``.statement`` attribute of the
:class:`_sql.Compiler` object.   However, all SQL constructs are
ultimately nestable, and this attribute should never be consulted
by a ``visit_`` method, as it is not guaranteed to be assigned
nor guaranteed to correspond to the current statement being compiled.

.. versionadded:: 1.3.21

    For compatibility with previous versions, use the following
    recipe::

        statement = getattr(self, "current_executable", False)
        if statement is False:
            statement = self.stack[-1]["selectable"]

    For versions 1.4 and above, ensure only .current_executable
    is used; the format of "self.stack" may change.


r$   z$Compiler does not have a stack entryN)r  
IndexError)r  ies     r   current_executableSQLCompiler.current_executable  s;    <	M::b>,// 	MCD"L	Ms    
/*/c                X    [        U R                  5      [        U R                  5      -   $ r  )listrD  rE  r3  s    r   prefetchSQLCompiler.prefetch%  s#    D(()D1E1E,FFFr   c                    0 $ r  r   r3  s    r   _global_attributesSQLCompiler._global_attributes)  s    	r   c                f    [         R                  " 5       nXl        0 U l        0 U l        SU l        U$ )zzInitialize collections related to CTEs only if
a CTE is located, to save on the overhead of
these collections otherwise.

F)r&   OrderedDictre  rf  rg  rh  )r  re  s     r   _init_cte_stateSQLCompiler._init_cte_state-  s8     *.)9)9);	 #% "$#r   c              #    #    U R                   U R                  p!/ SsU l         U l         U R                  (       a  U R                  S   nSUS'   OSnU R                   U R                  4v   U(       a  UR                  S5        UUsU l         U l        g! W(       a  UR                  S5        UUsU l         U l        f = f7f)z;special API to support the use case of 'nested result sets'Fr  Tr  N)r  rS  r  r}  )r  result_columnsordered_columnsentrys       r   _nested_resultSQLCompiler._nested_resultE  s        !! ( 79%3d3	zz

26:23&&(=(===		67 8D $"7 		67 8D $"7s   'C AB ,(C )B==C c                <  ^^	 U R                   (       a   eU R                  [        R                  L d   eU R                  (       a   eU R
                  R                  S:X  a  SmOU R
                  R                  S:X  d   eSm/ m	SUU	4S jjn[        R                  " U R                  XR                  5      U l
        U R                  (       ay  U R                  R                  5        VVs0 s H  u  p#X2_M	     nnn[        U R                  5      [        U5      :X  d   eT	 Vs/ s H  oTR                  XU5      PM     snU l         OT	U l         U R                  (       a  / m	[        R                  " U R                  UU R                  R                   5      nU R                  R"                   Vs/ s H4  nUS   US   [        R                  " U R                  XS   5      US	   4PM6     nnU R                  R%                  UUS
9U l        g g s  snnf s  snf s  snf )Nr   %sr   r   c                   > U R                  S5      nU(       a  TR                  U5        T$ TR                  U R                  S5      5        U R                  S5      $ )Nr   r6   r   )r   append)mnormal_bindplaceholder	positionss     r   find_position6SQLCompiler._process_positional.<locals>.find_positionj  sM    ''!*K  -""   ,wwqz!r   r   r   r6   r  r=  r?  )r  zre.Match[str]r
  r   )r(  r  rf  rh  rU  r  r|  rn  sub_positional_patternr  r`  r  lengetr\  r=  r?  _replace)
r  r  r  r  reverse_escaper   r=  r?  r  r  s
           @@r   r  SQLCompiler._process_positional]  s   ####zz]99999&&&&<<""h.K<<**g555K		" 	" ff$$m[[
 ""/3/F/F/L/L/NO/Ntqad/NNOt../3~3FFFF;D ;D4""4.9 D  )D!!I!#((&&99" //BB" CA aDaDFF433]aDIaD	 C  " &*%;%;%D%D#5#5 &E &D"% " P "s   ,H%H0;Hc                  ^ ^ T R                   (       d   eT R                  [        R                  L d   eSn0 mT R                  (       a_  T R
                  bR  [        R                  " U 4S jT R                  R                  5        5       T R                  R                  5       5      nOT R                  R                  5       nU H[  nUT;   a  M  T R                  U   nUT R                  ;   d  UT R                  ;   a  S TU'   MA  T R                   U 3nUS-  nUTU'   M]     UT l        [        T5      T l        T R"                  (       a[  [%        T5      nTR'                  5        VVs0 s H!  u  pxT R"                  R)                  Xw5      U_M#     snnm[%        T5      U:X  d   eT R*                  R-                  U4S jT R.                  5      T l        T R                  (       al  T R                  R0                  T-  n	T R                  R2                   V
s/ s H  n
U
S   U
S   SU
S   4PM     nn
T R                  R5                  U	US9T l        g g s  snnf s  sn
f )Nr   c              3  L   >#    U  H  nUTR                   ;  d  M  Uv   M     g 7fr  )rb  )r-  r   r  s     r   r/  /SQLCompiler._process_numeric.<locals>.<genexpr>  s(       84#9#99 D 8s   $	$c                ,   > TU R                  S5         $ Nr   r   r  	param_poss    r   <lambda>.SQLCompiler._process_numeric.<locals>.<lambda>  s    i
+r   r   r  r  r  )rU  r  rf  rh  r\  rb  	itertoolschainrJ  valuesrI  r_  r^  rP  next_numeric_posr  r(  r`  r  r  r  _pyformat_patternr  r  r=  r?  r  )r  numr   	bind_namebindph
len_beforer   posr=  r  r?  r  s   `           @r   r  SQLCompiler._process_numeric  sJ   """"zz]99999$&	!!d&<&<&H OO $ 6 6 8
 &&(E OO**,EII%::i(D0004666 (,	)$;;<SEBq')	)$   !$	?""YJ "+!2!2ID ''++D7<!2I y>Z/// ,,00+T[[
 !! &&99  //BB"BA 1qtT1Q4(B  "
 &*%;%;%D%D#5#5	 &E &D" "$"s   *(IIc                p   ^  U 4S jT R                    5        VVs0 s H  u  pUc  M
  X_M     snn$ s  snnf )Nc           	   3  0  >#    U  H  nTR                   U   UR                  R                  (       d%  UR                  R                  TR                  5      O6[        U4S  j[        [        UR                  5      R                   5       5      4v   M     g7f)c              3  Z   >#    U  H   nUR                  TR                  5      v   M"     g 7fr  )_cached_bind_processorr  )r-  	elem_typer  s     r   r/  9SQLCompiler._bind_processors.<locals>.<genexpr>.<genexpr>  s.      #.$	 &<<T\\JJ.$   (+N)	rJ  r   _is_tuple_typer  r  r2  r   r2   types)r-  	bindparamr  s     r   r/  /SQLCompiler._bind_processors.<locals>.<genexpr>  s~       "1I OOI.  )~~<< "==dllK" #-1 )9>>.#e.$#  "1s   BB)rJ  )r  r.  values   `  r   _bind_processorsSQLCompiler._bind_processors  sG     "&

  # CJ
 	
 
s   	22c                2    [        U R                  5      S:  $ r  )r  r  r3  s    r   is_subquerySQLCompiler.is_subquery  s    4::""r   c                    U $ r  r   r3  s    r   r  SQLCompiler.sql_compiler  s    r   c                F    U R                  UUSS9nU R                  U5      $ )a*  Return a new :class:`.ExpandedState` for a given parameter set.

For queries that use "expanding" or other late-rendered parameters,
this method will provide for both the finalized SQL string as well
as the parameters that would be used for a particular parameter set.

.. versionadded:: 2.0.0rc1

Tru  )r  r  )r  r  r  r$  s       r   construct_expanded_state$SQLCompiler.construct_expanded_state  s:     **%  + 


 77
 	
r   c                   U R                   (       aR  U(       dK  U R                  c   eU(       d  [        U R                  R                  5      $ [        R
                  " S5      eU=(       a    [        U R                  5      nU(       au  U R                  c  [        R                  " S5      eU R                  S   nU R                  n	U	c   eU	u  p[        X5       VVVs0 s H  u  pX     H  nX_M     M     nnnnOSnU(       Ga6  0 nU R                  R                  5        GH  u  nnU(       a  U R                  R                  UU5      OUnUR                  U;   a  UUR                     UU'   MP  UU;   a
  UU   UU'   M`  U(       a^  UR                   (       aM  U(       a$  [        R
                  " SUR                  U4-  SS9e[        R
                  " SUR                  -  SS9eU(       a  UR                  UU5      nOUnUR"                  (       a  UR$                  UU'   GM  UR&                  UU'   GM     U$ 0 nU R                  R                  5        H  u  nnU(       a  U R                  R                  UU5      OUnU(       a^  UR                   (       aM  U(       a$  [        R
                  " SUR                  U4-  SS9e[        R
                  " SUR                  -  SS9eU(       a  UR                  UU5      nOUnUR"                  (       a  UR$                  UU'   M  UR&                  UU'   M     U$ s  snnnf )	z5return a dictionary of bind parameter keys and valuesNzcan't construct new parameters when render_postcompile is used; the statement is hard-linked to the original parameters.  Use construct_expanded_state to generate a new statement and parameters.zcThis compiled object has no original cache key; can't pass extracted_parameters to construct_paramsr   z@A value is required for bind parameter %r, in parameter group %dcd3x)codez)A value is required for bind parameter %r)rV  rW  dictr$  r7   r1  r  r`  r  CompileErrorra  ziprJ  r  r  r.  requiredcallableeffective_valuer  )r  r  r  r  _group_number_checkrv  has_escaped_namesorig_extracted
ckbm_tupler  r4  r  	extractedr  resolved_extractedpdr  r   escaped_namevalue_params                        r   r  SQLCompiler.construct_params  s7    ##O44@@@D==HHII--4  )JT$2I2I-J ~~%&&J 
 "&!233J))) GD %($M"$MLA GD # $M  " "&B#'??#8#8#:	4 ) ++//d;  ==F*'-imm'<B|$V^'-d|B|$	 2 2$!554(}}m<= "(	  "55G'mm,!'  *&8&<&<%y' '0 ))+6+F+F<(+6+<+<<(K $;L IB#'??#8#8#:	4 ) ++//d;  i00$!554(}}m<= "(	  "55G'mm,!'  &"4"8"8I"NK"+K%%'2'B'BB|$'2'8'8B|$= $;@ Ig"s   L=c                  ^^^^	 U R                   mTR                  m	TR                  mTR                  mUUUU	4S jn0 nU R                  nU R
                   Hx  nXC;   a  M
  UR                  R                  (       a?  [        [        UR                  5      R                   Vs/ s H  nU" U5      PM     snX$'   Md  U" UR                  5      X$'   Mz     U$ s  snf )Nc                t   > U R                  T5      R                  T5      nUb  Tb  UT;  a  Tb  UT;   a  U$ g r  )_unwrapped_dialect_implget_dbapi_type)typdbtypedbapir  exclude_typesinclude_typess     r   lookup_type<SQLCompiler._get_set_input_sizes_lookup.<locals>.lookup_type  sH    009HHOF ""*fM.I"*f.Er   )r  include_set_input_sizesexclude_set_input_sizesr  r^  rJ  r   r  r   r2   r  )
r  r  
inputsizesr^  r  r  r  r  r  r  s
         @@@@r   _get_set_input_sizes_lookup'SQLCompiler._get_set_input_sizes_lookup  s    ,,7777
	 
	 
!%!<!<I2~~,,  $Iy~~>DD)D  $D)
%
 )4INN(C
% ) )s   #Cc                     U R                  SS9$ )zReturn the bind param dictionary embedded into this
compiled object, for those values that are present.

.. seealso::

    :ref:`faq_sql_expression_string` - includes a usage example for
    debugging use cases.

F)r   r  r3  s    r   r  SQLCompiler.params  s     $$E$22r   c                4  ^^^^^ 0 nU R                   nUc  U R                  nU R                  (       a  / nU R                  nUc  U R                  nOS=pVU R
                  n[        SU5      m[        SU5      m0 n0 m0 n	Sn
U R                  (       a  Ub  UnU R                  (       a  / n
OU R                  R                  5       nU R                  nU GH  mU(       a  UR                  TT5      OTnU R                  T   nXR                  ;   a*  UT;  a"  U R                  UUR                  U5      S9TU'   Mg  XR                   ;   Ga  UT;   a  X   nSnO1UR                  T5      nU R#                  XU5      nUu  nnXU'   UTU'   UR$                  (       d  UR'                  U5        UR(                  R*                  (       a,  Uc   eUR'                  UU4S j[-        US5       5       5        OUR'                  UU4S jU 5       5        U
b  U
R/                  S U 5       5        OUb  UR/                  S	 U 5       5        U VVs/ s H  u  nnUPM
     snnUT'   GM  GM  Uc  GM  UR1                  T5        GM     U4S
 jn[2        R4                  " U R6                  UU5      nU
bp  Uc   e[-        XR8                  5       VVs0 s H  u  nnUU R:                   U 3_M     snnmU R<                  R5                  U4S jU5      nUR/                  U
5        [?        UUUUU5      nU(       aZ  X@l         X`l        UR@                  U l        U R                  (       a  [C        UR                  =(       d    S5      OSU l        UU l"        U$ s  snnf s  snnf )af  handle special post compile parameters.

These include:

* "expanding" parameters -typically IN tuples that are rendered
  on a per-parameter basis for an otherwise fixed SQL statement string.

* literal_binds compiled with the literal_execute flag.  Used for
  things like SQL Server "TOP N" where the driver does not accommodate
  N as a bound parameter.

Nr%  z/Mapping[str, Sequence[_BindProcessorType[Any]]]render_literal_valuec              3     >#    U  HK  u  p[        US 5        H5  u  p4TT;   d  M  TT   US -
     c  M  T< SU< SU< 3TT   US -
     4v   M7     MM     g7f)r   Nr4  )	enumerate)r-  ituple_elementjr4  r   tuple_processorss        r   r/  BSQLCompiler._process_parameters_for_postcompile.<locals>.<genexpr>=  s{      	.
 5I 0(1-(C#'77 !1 6q1u =.2Aq 9 0 6q1u =
 )D 5Is   A
A#Ar   c              3  F   >#    U  H  u  pTT;   d  M  UTT   4v   M     g 7fr  r   )r-  r.  r4  r   single_processorss      r   r/  r%  H  s0      .*3#'88 ;S"3D"9:*3s   !!c              3  *   #    U  H	  u  pUv   M     g 7fr  r   r-  r   r4  s      r   r/  r%  N  s      309WTD	   c              3  *   #    U  H	  u  pUv   M     g 7fr  r   r)  s      r   r/  r%  U  s     .M9t9r*  c                  >^^ U R                  S5      nTU   nU R                  S5      (       aV  U R                  S5      R                  S5      nUS   US   smmSR                  UU4S jUR                  S5       5       5      nU$ )Nr   r6   ~~r  r   c              3  :   >#    U  H  nT< U< T< 3v   M     g 7fr  r   )r-  expbe_leftbe_rights     r   r/  ]SQLCompiler._process_parameters_for_postcompile.<locals>.process_expanding.<locals>.<genexpr>e  s      !/ !(h7/s   )r   splitrw   )r  r.  exprtokr0  r1  replacement_expressionss       @@r   process_expandingJSQLCompiler._process_parameters_for_postcompile.<locals>.process_expanding\  s    ''!*C*3/D wwqzzggaj&&t,$'FCF!yy !#zz$/!  Kr   c                ,   > TU R                  S5         $ r  r  r  s    r   r  ASQLCompiler._process_parameters_for_postcompile.<locals>.<lambda>y  s    )AGGAJ/r   r   )#rY  r  rt  r[  r(  r  r   rU  rJ  r  r`  r  rI  r^  render_literal_bindparamr}  r_  $_literal_execute_expanding_parameterliteral_executer  r   r  r   extendr  rn  r  _post_compile_patternr  rP  r  r"  r#  r  rW  )r  r$  rw  expanded_parameterspre_expanded_stringnew_positiontuppre_expanded_positiontupr&  new_processorsto_update_setsnumeric_positiontupnamesebnr  	parameter	to_updater  leep_resreplacement_expr
expand_keyr4  r7  r#  r  r.  expanded_stater   r  r6  r'  r$  s                             @@@@@r   r  /SQLCompiler._process_parameters_for_postcompile  s   $ ! #77&"&++?? O'+'E'E$'/+/+;+;( :>=O**
 3Z
  =z
 >@24)+ 48??7C#;E""&(#OO**,E%%D253774.4L

4(I777'>>55%1;1M 6  ,L9 444#:: . <I!F (^^D1F#HH$ H 5=1Y 03<<0<L+L9 00%%i0 ~~44%111&-- 	.
 5>fa4H	. 	 '-- .*3. 
 +6+22 3093  )4 (...M9.MM8A18A}z1
	1'-; 1@ !,&&t,S V	 FF&&(9;N
	 *"... !*')>)>!!HC ;;<SEBB!I ..22/I ""#67&
  )<%-E*(22DK ?? ^//526 
 1?D-{16s   	N	Nzsqlalchemy.engine.cursorc                    [         R                  R                  nUR                  R	                  U R
                  5      $ )z(utility method used for unit tests only.)r&   	preloadedengine_cursorrT   _create_description_match_mapr  )r  cursors     r   _create_result_mapSQLCompiler._create_result_map  s5     --**HH  
 	
r   _BindNameForColProtocol_get_bind_name_for_colc                    U R                   nU$ r  )rX  )r  getters     r   _within_exec_param_key_getter)SQLCompiler._within_exec_param_key_getter  s    ,,r   zsqlalchemy.engine.resultc           	       ^^	^
^^^ [         R                  R                  nU R                  nU R                  c   eU R                  R
                  n[        (       a  [        U[        5      (       d   eUR                  nUR                   Vs/ s H#  n[        R                  " SU" U5      S 5      U4PM%     snmS m	UR                  mTbG  TR                  R                  U R                   S 5      mU" T5      m
T
U R"                  ;   a  U
4S jnUm	OS mUR%                  UR                   Vs/ s H  oUR&                  PM     sn5      mUU	UUU4S jnU$ s  snf s  snf )Nr  c                6   > UR                  TU 5      nUb  U$ U $ r  r  )	lastrowidr$  param_valueautoinc_keys      r   _autoinc_getterPSQLCompiler._inserted_primary_key_from_lastrowid_getter.<locals>._autoinc_getter  s)    ",..i"HK".
  +*  )(r   c                r   >^ ^ Tb  T" T 5      m T c  T" U4S jT 5       5      $ T" UUU U4S jT 5       5      $ )zgiven cursor.lastrowid value and the parameters used for INSERT,
return a "row" that represents the primary key, either by
using the "lastrowid" or by extracting values from the parameters
that were sent along with the INSERT.

c              3  8   >#    U  H  u  pU" T5      v   M     g 7fr  r   )r-  rZ  r  r$  s      r   r/  WSQLCompiler._inserted_primary_key_from_lastrowid_getter.<locals>.get.<locals>.<genexpr>  s     LG[VfZ00G   c              3  ^   >#    U  H"  u  pUTL a  Tb	  T" TT5      O	TOU" T5      v   M$     g 7fr  r   )r-  rZ  r  autoinc_colautoinc_getterr`  r$  s      r   r/  rg    sI       (/ +-  .9 +9jA!* $J/0 (/   *-r   )r`  r$  rj  rk  getterslastrowid_processorrow_fns   ``r   r  DSQLCompiler._inserted_primary_key_from_lastrowid_getter.<locals>.get  sH     #./	:	 LGLLL  (/  r   )r&   rQ  engine_resultr[  r  r#  r   r  rA   r   primary_keyoperatormethodcaller_autoincrement_columnr   _cached_result_processorr  rI  result_tupler.  )r  resultparam_key_getterr#  r   r  rc  r  rj  rk  rb  rm  rn  ro  s           @@@@@@r   +_inserted_primary_key_from_lastrowid_getter7SQLCompiler._inserted_primary_key_from_lastrowid_getter  sQ    --==!!---&&00	=i0000 ((
( ""5*:3*?FL(

 11""-"2"2"K"Kd# +;7K djj(
) "1 #'$$9J9J%K9J#gg9J%KL	 	4 
G
N &Ls   *E.Ec                  ^
^ [         R                  (       a  SSKJn  O[        R
                  R                  nU R                  c   eU R                  R                  n[        (       a  [        U[        5      (       d   eU R                  nUR                  nU R                  nUc   e[        U5       VVs0 s H  u  pgXv_M	     nnn[        SUR                    Vs/ s HB  nXx;   a  ["        R$                  " X   5      S4O["        R&                  " SU" U5      S 5      S4PMD     sn5      m
UR)                  UR                    Vs/ s H  owR*                  PM     sn5      mU
U4S jn	U	$ s  snnf s  snf s  snf )Nr6   )rx  z'List[Tuple[Callable[[Any], Any], bool]]Tr  Fc                .   >^ ^ T" UU 4S jT 5       5      $ )Nc              3  V   >#    U  H  u  pU(       a  U" T5      OU" T5      v   M      g 7fr  r   )r-  rZ  use_rowr$  rows      r   r/  WSQLCompiler._inserted_primary_key_from_returning_getter.<locals>.get.<locals>.<genexpr>"	  s*      '.OF  'sF:,>>'.s   &)r   )r  r$  rm  ro  s   ``r   r  DSQLCompiler._inserted_primary_key_from_returning_getter.<locals>.get!	  s     '.  r   )typingr   enginerx  r&   rQ  rq  r  r#  r  rA   r[  r   rG  r   r   rr  rs  
itemgetterrt  rw  r.  )r  rx  r#  ry  r   r  idxr  retr  rm  ro  s             @@r   +_inserted_primary_key_from_returning_getter7SQLCompiler._inserted_primary_key_from_returning_getter  sf    '^^11F!!---&&00	=i0000==++	$$$(1)(<=(<HCsx(<=5 !,, -C z ((2D9 !--!#3C#8$ 	 -
" $$9J9J%K9J#gg9J%KL	 
7 > &Ls   7E*A	E0
E5c                    g)zCalled when a SELECT statement has no froms, and no FROM clause is
to be appended.

Gives Oracle Database a chance to tack on a ``FROM DUAL`` to the string
output.

r  r   r3  s    r   default_fromSQLCompiler.default_from)	  s     r   c                   UR                   R                  " U 40 UD6nUR                   GHM  nX@R                  ;  a  M  U R                  U   nUR	                  UR                  UR
                     SSS9nU R                  U   nU=U R                  U'   U R                  U'   XpR                  U'   U R                  R                  US5        XPR                  ;   a  U =R                  U1-  sl        XPR                  ;   a  U =R                  U1-  sl	        U R                  nU(       d  GM  Uu  pUR                   H6  nUR
                  U
;   d  M  XR
                     nX   R                  U5        M8     GMP     U$ )aB  SQL compile the nested element of an _OverrideBinds with
bindparams swapped out.

The _OverrideBinds is not normally expected to be compiled; it
is meant to be used when an already cached statement is to be used,
the compilation was already performed, and only the bound params should
be swapped in at execution time.

However, there are test cases that exericise this object, and
additionally the ORM subquery loader is known to feed in expressions
which include this construct into new queries (discovered in #11173),
so it has to do the right thing at compile time as well.

TF)maintain_keyr  N)r  r  	translaterI  _with_valuer.  rJ  r}  r_  r^  ra  _cloned_setr  )r  override_bindsr  sqltextr  bpnew_bpr   r  r  r  cbs               r   visit_override_binds SQLCompiler.visit_override_binds3	  sR   " !((;;DGBG  ))A

"AB ^^((0! $ F ??2&D/55DJJqMDJJt,&*OOF#OOD)---((VH4(000++x7+33Jz'
..Bvv~!&&\/ )? *H r   c                H    SUR                   R                  " U 40 UD6-   S-   $ Nr6  r7  r  r  )r  groupingasfromr  s       r   visit_groupingSQLCompiler.visit_groupings	  (    X%%88HHH3NNr   c                H    SUR                   R                  " U 40 UD6-   S-   $ r  r  )r  r  r  s      r   visit_select_statement_grouping+SQLCompiler.visit_select_statement_groupingv	  r  r   c                $   U R                   (       a  U R                  R                  (       a   [        SU R                   S   S   5      nUR                  u  nnnU(       a  Un	OUn	UR                  R                  n
U
bK  U
R                  U	;   a;  U
R                  XR                     5      (       a  UR                  R                  US'   U R                  " UR                  4SU0UD6$ ! [         a  n[
        R                  " S5      UeS nAff = f)N'Union[SelectState, CompoundSelectState]r  r  ECan't resolve label reference for ORDER BY / GROUP BY / DISTINCT etc.render_label_as_labelwithin_columns_clause)r  r  supports_simple_order_by_labelr   KeyErrorr7   r  _label_resolve_dictr  _order_by_label_elementr   shares_lineager  )r  r  r  r  r  ke	with_cols
only_froms	only_colsresolve_dictorder_by_elems              r   visit_label_reference!SQLCompiler.visit_label_referencey	  s    ::$,,EE	 $=JJrN?3! 11	$)( $OOCCM )!&&,6!00 !3!34 
 OO;; ./ ||OO
"7
 
 	
A  &&/ s   C) )
D3D

Dc                F   U R                   (       d  U R                  UR                  5      $  [        SU R                   S   S   5      nWR                  u  pgn U(       a  XqR                     n	OXaR                     n	XS'   U R                  " U	4SU0UD6$ ! [         a9  n[
        R                  " UR                  S[        R                  US9   S nANS nAff = f! [         a9  n
[
        R                  " UR                  S[        R                  U
S9   S n
A
g S n
A
ff = f)Nr  r  r  r  )extraexc_clsr  r  r  )r  r  _text_clauser   r  r   _no_text_coercionr  r7   r  r  )r  r  r  r  r  r  r  r  r  r  r  s              r   visit_textual_label_reference)SQLCompiler.visit_textual_label_reference	  s    zz<< 4 455	 9

2/M ,9+L+L(	y	$ 10 /2*+<<+@DJ ;  		''/ ((		"  		''/ ((		s/   B $C 
C!/CC
D '/DD c                   U=(       a    U(       + nXQL n	U	(       d  U(       aR  [        UR                  [        R                  5      (       a  U R	                  SUR                  5      n
OUR                  n
U(       a  Ub0  U" W
UR                  X4UR
                  -   U-   UR                  5        UR                  R                  " U 4SSS.UD6[        [        R                     -   U R                  R                  UW
5      -   $ U	(       a  U R                  R                  UW
5      $ UR                  R                  " U 4SS0UD6$ )NcolidentT)r  within_label_clauser  F)r  r   r   rD   _truncated_identifierr	  r   r  r  	OPERATORSr!   as_r  format_label)r  r  add_to_result_mapr  r  r  result_map_targetsr  render_label_with_asrender_label_only	labelnames              r   visit_labelSQLCompiler.visit_label	  s:    "=*=&= 	 2: 4%**h&?&?@@ 66z5::N	!JJ	 ,!JJ&)9)99<NNJJ	 00*.(, 	 IMM*+ --,,UI>?	 ==--eY??==33,157 r   c                .    [         R                  " S5      e)Nz:Cannot compile Column object until its 'name' is assigned.r7   r  r  r   s     r   _fallback_column_name!SQLCompiler._fallback_column_name
  s    H
 	
r   c                @    UR                   nU R                  " U40 UD6$ r  )	_resolvedr  )r  r  r  sql_elements       r   visit_lambda_element SQLCompiler.visit_lambda_element
  s!    ''||K.2..r   c                   UR                   =pxUc  U R                  U5      nUR                  n	U	(       d1  [        U[        R
                  5      (       a  U R                  SU5      nUbD  XUR                  4U-   n
UR                  (       a  XR                  4-  n
U" XxXR                  5        U	(       a  U R                  U5      nOU R                  R                  U5      nUR                  nUb  U(       a  UR                  (       d  U$ U R                  R                  U5      nU(       a  U R                  R!                  U5      S-   nOSn["        (       a  [        U[$        5      (       d   eUR                   nU(       d  U(       a	  X;   a  X^   n[        U[        R
                  5      (       a  U R                  SU5      nXR                  R                  U5      -   S-   U-   $ )Nr  r9  r  alias)r   r  
is_literalr  r   rD   r  r.  	_tq_labelr   escape_literal_columnr  quoter   named_with_columnschema_for_objectquote_schemar   rO   )r  r   r  include_tabler  ambiguous_table_name_mapr  r   	orig_namer  targetsr   effective_schemaschema_prefix	tablenames                  r   visit_columnSQLCompiler.visit_column
  s    ";;&<--f5D&&
jx/H/HII--j$?D(VZZ03EEG,,..dwD --d3D==&&t,D=U5L5LK#}}>>uEMM../?@3F  !#}!%9999

I %,94?	)X%>%>?? 66w	J	 ==#6#6y#AACG$NNr   c                L    U R                   R                  UR                  5      $ r  )r  format_collation	collationr  r  r  s      r   visit_collationSQLCompiler.visit_collationJ
  s    }}--g.?.?@@r   c                    UR                   $ r  r   )r  
fromclauser  s      r   visit_fromclauseSQLCompiler.visit_fromclauseM
  s    r   c                    UR                   $ r  r  )r  ru  r  s      r   visit_indexSQLCompiler.visit_indexP
  s    zzr   c                    XS'   U R                   US'   U R                  R                  R                  " UR                  40 UD6$ )Ntype_expressionr  )r  r  type_compiler_instancer  r   )r  
typeclauser  s      r   visit_typeclauseSQLCompiler.visit_typeclauseS
  sF     *$(MM !||22::OO
!
 	
r   c                `    U R                   R                  (       a  UR                  SS5      nU$ Nr5  %%r  _double_percentsreplacer  texts     r   post_process_textSQLCompiler.post_process_textZ
  $    ==))<<T*Dr   c                `    U R                   R                  (       a  UR                  SS5      nU$ r  r  r  s     r   r  !SQLCompiler.escape_literal_column_
  r  r   c           	       ^ ^^ UU U4S jnT R                   (       d  ST l        U(       a  U" S S T4[        R                  5        [        R                  S [        R                  UT R                  TR                  5      5      5      $ )Nc                   > U R                  S5      nUTR                  ;   a   TR                  " TR                  U   40 TD6$ TR                  " U40 TD6$ r  )r   _bindparamsr  bindparam_string)r  r   r  r  
textclauses     r   do_bindparam2SQLCompiler.visit_textclause.<locals>.do_bindparame
  sS    771:Dz---||J$:$:4$@GBGG,,T8R88r   Tc                $    U R                  S5      $ r  r  )r  s    r   r  .SQLCompiler.visit_textclause.<locals>.<lambda>w
  s    aggajr   )	r  rH  r%   NULLTYPEBIND_PARAMS_ESCr  BIND_PARAMSr  r  )r  r  r  r  r  s   `` ` r   visit_textclauseSQLCompiler.visit_textclaused
  sl    	9 zz#D dD:-9J9JK "" OOd44Z__E
 	
r   c                   U R                   (       + nU(       a  U R                  OU R                   S   n[        5       [        5       US.nU R                   R                  U5        UR                  (       a  U R                  X5        U=(       d7    US:H  =(       a    UR                  SS5      =(       d    UR                  SS5      nU(       ax  UR                  =U l        U l	        UR                  (       + =(       a    [        UR                  5      U l        UR                   H  n	U R                  U	SU R                  S9  M      U R                  " UR                  40 UD6n
U R                   (       a0  U(       d  [#        U R                   5      OS nU R%                  US	9U
-   n
U R                   R'                  S5        U
$ )
Nr  r  r  r$   r   r  Fr  T)r  r  nesting_level)r  _default_stack_entryro   r  _independent_ctes_dispatch_independent_ctesr  rt  rS  rQ  r  column_argsrT  r  _add_to_result_mapr  re  r  _render_cte_clauser}  )r  tafcompound_indexr  r  toplevelr  	new_entrypopulate_result_mapr  r  r  s               r   visit_textual_select SQLCompiler.visit_textual_select}
  sw    zz>-5))4::b>  #uE*
	
 	

)$  ++C4  >!# EII<eD>
 yy5u= 	 D!D$A 47>>/A 0dGD, __*.&*&=&=   % ||CKK.2.993;C

OM***G$ND

rr   c                    gNNULLr   r  r4  r  s      r   
visit_nullSQLCompiler.visit_null
      r   c                <    U R                   R                  (       a  gg)Nr~   1r  supports_native_booleanr*  s      r   
visit_trueSQLCompiler.visit_true
  s    <<//r   c                <    U R                   R                  (       a  gg)Nr   0r0  r*  s      r   visit_falseSQLCompiler.visit_false
  s    <<//r   c                L   ^ ^ UR                  S UU 4S jU 5        5       5      $ )Nc              3  8   #    U  H  nU(       d  M  Uv   M     g 7fr  r   r-  ss     r   r/  7SQLCompiler._generate_delimited_list.<locals>.<genexpr>
  s      
I AI   	c              3  H   >#    U  H  oR                   " T40 TD6v   M     g 7fr  r  r-  r  r  r  s     r   r/  r<  
  s     I1**4626   "rw   )r  r   	separatorr  s   `  `r   _generate_delimited_list$SQLCompiler._generate_delimited_list
  s&    ~~ 
II
 
 	
r   c                v  ^ ^ [         R                  R                  [        R                  [         R
                  R                  [         R                  R                  U5      u  p1US:X  a  US   R                  " T 40 TD6$ [        [        R                     nUR                  S UU 4S jU 5        5       5      $ )Nr   r   c              3  8   #    U  H  nU(       d  M  Uv   M     g 7fr  r   r:  s     r   r/  ;SQLCompiler._generate_delimited_and_list.<locals>.<genexpr>
  s      "LA Lr=  c              3  H   >#    U  H  oR                   " T40 TD6v   M     g 7fr  r  r?  s     r   r/  rG  
  s     LGq..t:r:Gr@  )r   BooleanClauseList_process_clauses_for_booleanr!   and_True_
_singletonFalse_r  r  rw   )r  clausesr  lccrB  s   ` `  r   _generate_delimited_and_list(SQLCompiler._generate_delimited_and_list
  s    11NNNNNN%%OO&&	
 !81:00<<<!)..1I>> "LGL"  r   c                .    SU R                   " U40 UD6-  $ N(%s))visit_clauselist)r  
clauselistr  s      r   visit_tupleSQLCompiler.visit_tuple
  s    --j?B???r   c                    UR                   nUc  SnO[        UR                      nU R                  " UR                  U40 UD6$ Nr<  )rs  r  rC  rO  )r  rW  r  seps       r   rV  SQLCompiler.visit_clauselist
  sE    !!;CJ//0C,,Z-?-?KKKr   c                   UR                   nU R                  USS 5      nU(       a	  U" X40 UD6$  [        U   nSUS'   U R                  " UR                  U40 UD6$ ! [
         a  n[        R                  " X5      UeS nAff = f)Nexpression_clauselistT_in_operator_expression)rs  _get_operator_dispatchr  rC  rO  r  r7   r  )r  rW  r  	operator_dispopstringr  s          r   visit_expression_clauselist'SQLCompiler.visit_expression_clauselist
  s    ''	**.
 
444	 +H -1B()00""H02 	  	L11$BK	Ls   	A 
B'A>>Bc                h   SnUR                   b"  X1R                   R                  " U 40 UD6S-   -  nUR                   H8  u  pEUSUR                  " U 40 UD6-   S-   UR                  " U 40 UD6-   S-   -  nM:     UR                  b&  USUR                  R                  " U 40 UD6-   S-   -  nUS-  nU$ )NzCASE r<  zWHEN z THEN zELSE END)r  r  whenselse_)r  clauser  xcondrx  s         r   
visit_caseSQLCompiler.visit_case
  s    <<#00@@3FFA"LLLD))$9&9: ++D;F;< 	A ) <<#&,,99$I&IICOA 	
U
r   c                <    UR                   R                  " U 40 UD6$ r  )typed_expressionr  )r  type_coercer  s      r   visit_type_coerceSQLCompiler.visit_type_coerce
  s    ++>>tJrJJr   c                "   UR                   R                  " U 40 UD6n[        R                  " SU5      nSUR                  R                  " U 40 UD6< SU(       a  UR                  S5      OU< SU(       a  UR                  S5      < 3$ S< 3$ )Nz(.*)( COLLATE .*)zCAST(r   r   r7  r6   r  )r  r  rn  matchrk  r   )r  r   r  type_clauserv  s        r   
visit_castSQLCompiler.visit_cast  s    oo88HH,k:KK**4:6:#EKKN4#EKKN+
 	
 *,+
 	
r   c           
        US   [         R                  L a  SOUS   [         R                  L a  SOmUS   S:  a7  U R                  " [         R                  " [        US   5      5      40 UD6< S3O-U R                  " [         R                  " US   5      40 UD6< S3< SUS   [         R                  L a  S< 3$ US   [         R                  L a  S< 3$ US   S:  a:  U R                  " [         R                  " [        US   5      5      40 UD6< S3< 3$ U R                  " [         R                  " US   5      40 UD6< S3< 3$ )	Nr   zUNBOUNDED PRECEDINGzCURRENT ROWz
 PRECEDINGz
 FOLLOWINGr   r   zUNBOUNDED FOLLOWING)r   RANGE_UNBOUNDEDRANGE_CURRENTr  literalabs)r  range_r  s      r   _format_frame_clause SQLCompiler._format_frame_clause  su    !9 8 88 & ayH$:$:: " "!9q=	 !LL ( 0 0VAY @DF  <<(8(8(CJrJM( !9 8 88 & +'
 '	
2 ayH$:$:: "+'
 '	
B "!9q=	 !LL ( 0 0VAY @DF+'
 '	
F  <<(8(8(CJrJM+'
 '	
r   c                   UR                   R                  " U 40 UD6nUR                  (       a!  SU R                  " UR                  40 UD6-  nO4UR                  (       a!  SU R                  " UR                  40 UD6-  nOS nU< SSR                  SUR                  4SUR                  44 VVs/ s H6  u  pVUc  M
  [        U5      (       d  M  U< SUR                  " U 40 UD6< 3PM8     snnU(       a  U/O/ -   5      < S3$ s  snnf )	NzRANGE BETWEEN %szROWS BETWEEN %sz OVER (r<  	PARTITIONORDERz BY r7  )	r  r  r  r  rowsrw   partition_byorder_byr  )r  overr  r  r  wordrk  s          r   
visit_overSQLCompiler.visit_over@  s   ||..t>v>;;'$*C*C+%+ F YY&)B)B		*#* F F HH
 %d&7&78 $--0)) H /2&kHV66tFvFH)  &F82	/
 	
s   2	D?DDc                    UR                   R                  " U 40 UD6< SUR                  R                  " U 40 UD6< S3$ )Nz WITHIN GROUP (ORDER BY r7  )r  r  r  )r  withingroupr  s      r   visit_withingroupSQLCompiler.visit_withingroup]  s>    224B6B  33DCFC
 	
r   c                    UR                   R                  " U 40 UD6< SUR                  R                  " U 40 UD6< S3$ )Nz FILTER (WHERE r7  )funcr  	criterion)r  
funcfilterr  s      r   visit_funcfilterSQLCompiler.visit_funcfilterc  s<    OO..t>v>  33DCFC
 	
r   c                    U R                   R                  UR                  UR                  5      nSU< SUR                  R                  " U 40 UD6< S3$ )NzEXTRACT(r   r7  )extract_mapr  fieldr4  r  )r  extractr  r  s       r   visit_extractSQLCompiler.visit_extracti  sF      $$W]]GMMBLL++D;F;
 	
r   c                v    U R                   " UR                  40 UD6nU R                  " U40 UD6nSU< SU< 3$ )Nr6  z).)visit_functionfnr  )r  r  r  compiled_fncompiled_cols        r   visit_scalar_function_column(SQLCompiler.visit_scalar_function_columnp  s;    ))'**;;((7B7'66r   c           	        Ub4  U" UR                   UR                   UR                   4UR                  5        [        U SUR                   R                  5       -  S 5      nU(       a  U" U40 UD6nGOY[        R                  UR                  5       R                  S 5      nU(       a  UR                  (       a  US-  nOmUR                   nU R                  R                  U5      (       d  [        U[        R                  5      (       a  U R                  R                  U5      OUnUS-   nSR                  UR                    Vs/ s H_  nU R                  R                  U5      (       d  [        U[        R                  5      (       a  U R                  R                  U5      OUPMa     snU/-   5      SU R"                  " U40 UD60-  nUR$                  (       a  US-  nU$ s  snf )Nzvisit_%s_funcz%(expr)sr9  r4  z WITH ORDINALITY)r   r   getattrlowerr   r  _deannotater  	_has_argsr  _requires_quotes_illegal_charsr  r   r0   r  rw   packagenamesfunction_argspec_with_ordinality)r  r  r  r  rc  r  r   r5  s           r   r  SQLCompiler.visit_functionu  s    (diiTYYL$))Lt_tyy/@@$G ''D==!1!1!3!=!=tDD>>J&Dyy }}CCDII!$(<(<== MM''- 	  j(88  $00  1	  ==GGLL%dH,@,@AA ++C0 !!
  1 &	 ..t>v>?@D   &&Ds   A&G#c                8    U R                  UR                  5      $ r  )visit_sequencesequence)r  
next_valuer  s      r   visit_next_value_func!SQLCompiler.visit_next_value_func  s    "":#6#677r   c                F    [        SU R                  R                  -  5      e)Nz2Dialect '%s' does not support sequence increments.r  r  r   r  r  r  s      r   r  SQLCompiler.visit_sequence  s$    !@ll 
 	
r   c                <    UR                   R                  " U 40 UD6$ r  )clause_exprr  )r  r  r  s      r   r  SQLCompiler.function_argspec  s    224B6BBr   c           
       ^ ^^ T R                   (       + nUR                  " UT 40 TD6nU(       a  T R                  (       d  UT l        UR                  nU(       a  T R                  OT R                   S   nU=(       d     U(       + =(       a    UR                  SS5      n	US:X  a  XS'   T R                   R                  US   US   UUU	S.5        UR                  (       a  T R                  UT5        T R                  UR                     n
S	U
-   S	-   R                  UUU 4S
 j[        UR                  5       5       5      nSTS'   UT R                  " U40 [        SST0TD6D6-  nUT R                   " U40 TD6-  nUR"                  (       a  UT R$                  " U40 TD6-  nT R&                  (       a1  U(       d  [)        T R                   5      OS nT R+                  USS9U-   nT R                   R-                  S5        U$ )Nr  r  Fr   r  r  r  )r  r  r$   r  r  r<  c              3  T   >#    U  H  u  pUR                   " T4TUS .TD6v   M     g7f))r  r!  Nr  )r-  r!  r  r  r  r  s      r   r/  4SQLCompiler.visit_compound_select.<locals>.<genexpr>  s>       2DA $$!'=C 2ry  r  r  Tr  include_following_stackr   )r  _compile_state_factoryr  r#  r  r  r  r  r  compound_keywordskeywordrw   r   selectsgroup_by_clauser  order_by_clause_has_row_limiting_clause_row_limit_clausere  r  r  r}  )r  csr  r!  r  r"  r  compound_stmtr  need_result_mapr  r  r  s   ` ` `        r   visit_compound_select!SQLCompiler.visit_compound_select  s    zz>11"dEfED..!.D%//-5))4::b>" 
 A		8%@ 	 Q "*

#():#; %n 5 !.0?	
 **++M6B((4g#)) &bjj1	
 #($$RI4+Hv+H+HII$$R2622&&D**2888D993;C

OM''"/,0 (  	  	

rr   c                h    UR                   b  U R                  " U40 UD6$ U R                  " U40 UD6$ r  )_fetch_clausefetch_clauselimit_clause)r  r  r  s      r   r  SQLCompiler._row_limit_clause  s:    '$$R2622$$R2622r   c                `    SUR                   < SU< U(       a  SU-   OS< 3n[        XS 5      $ )Nvisit_r4  r  )r   r  )r  rb  
qualifier1
qualifier2attrnames        r   ra  "SQLCompiler._get_operator_dispatch  s3     *C*2

 tt,,r   c                P   Ub  X14-  nX$S'   X4S'   UR                   (       a  UR                  (       a  [        R                  " S5      eU R	                  UR                   SS5      nU(       a  U" XR                   40 UD6$ U R
                  " U[        UR                      40 UD6$ UR                  (       a\  U R	                  UR                  SS5      nU(       a  U" XR                  40 UD6$ U R                  " U[        UR                     40 UD6$ [        R                  " S5      e)Nr  r  zFUnary expression does not support operator and modifier simultaneouslyunaryrs  modifierz,Unary expression has no operator or modifier)rs  r  r7   r  ra   _generate_generic_unary_operatorr   _generate_generic_unary_modifier)r  r  r  r  r  rc  s         r   visit_unarySQLCompiler.visit_unary  s*    ((*&7"#'9#$>>~~&&2  ..D E>>8R88<<9U^^48:  ^^..D E>>8R88<<9U^^48:  ""> r   c                   U R                   R                  (       a  U R                  " UR                  40 UD6S-   U R                  " [        R
                  " UR                  UR                  R                  R                  [        R                  L a  UR                  R                  O[        R                  " 5       5      40 UD6-   $ U R                  " UR                  40 UD6S-   U R                  " UR                  40 UD6-   $ )N / )r  div_is_floordivr  rx   r   Castr   r   _type_affinityr%   Numericr  r   rs  r  s       r   visit_truediv_binary SQLCompiler.visit_truediv_binary$  s    <<''V[[/B/ ,,MM  &||00??'// 0 #LL-- "*!1!1!3 	( V[[/B/,,v||2r23r   c                   U R                   R                  (       ao  UR                  R                  R                  [
        R                  L a>  U R                  " UR                  40 UD6S-   U R                  " UR                  40 UD6-   $ SU R                  " UR                  40 UD6S-   U R                  " UR                  40 UD6-   -  $ )Nr  z	FLOOR(%s))	r  r  r   r   r  r%   Integerr  rx   r  s       r   visit_floordiv_binary!SQLCompiler.visit_floordiv_binary?  s    LL((!!00H4D4DD V[[/B/,,v||2r23 V[[/B/,,v||2r23 r   c                    UR                   (       d  U R                  R                  (       a  U R                  " UR                  40 UD6$ SU R                  " UR                  40 UD6-  $ )Nz%s = 1_is_implicitly_booleanr  r1  r  r  r  r  rs  r  s       r   visit_is_true_unary_operator(SQLCompiler.visit_is_true_unary_operatorP  sM    **||33<<6266dll7??AbAAAr   c                    UR                   (       d  U R                  R                  (       a   SU R                  " UR                  40 UD6-  $ SU R                  " UR                  40 UD6-  $ )NNOT %sz%s = 0r  r  s       r   visit_is_false_unary_operator)SQLCompiler.visit_is_false_unary_operatorY  sR    **||33dll7??AbAAAdll7??AbAAAr   c                D    SU R                  U[        R                  S9-  $ )Nr  )override_operator)visit_binaryr!   match_opr  s       r   visit_not_match_op_binary%SQLCompiler.visit_not_match_op_binaryb  s,    $++i&8&8 , 
 
 	
r   c                >    SU R                   " U[        U   40 UD6-  $ rT  )_generate_generic_binaryr  r  s       r   visit_not_in_op_binary"SQLCompiler.visit_not_in_op_binaryg  s0     55Ih'
+-
 
 	
r   c                   U[         R                  L a+  [        U5      S:  a  SSR                  S U 5       5      -  $ gU[         R                  L a+  [        U5      S:  a  SSR                  S U 5       5      -  $ gU R                  U5      $ )	Nr   z(%s)) OR (1 = 1r   c              3  &   #    U  H  nS v   M	     g7fr)  Nr   r-  r  s     r   r/  6SQLCompiler.visit_empty_set_op_expr.<locals>.<genexpr>s       :EfE   zNULL) OR (1 = 1z(%s)) AND (1 != 1c              3  &   #    U  H  nS v   M	     g7fr  r   r  s     r   r/  r  z  r  r  zNULL) AND (1 != 1)r!   	not_in_opr  rw   in_opvisit_empty_set_expr)r  r  	expand_opr  s       r   visit_empty_set_op_expr#SQLCompiler.visit_empty_set_op_expro  s    	+++5zA~(II:E::  ))//)5zA~*II:E::  +,,U33r   c                F    [        SU R                  R                  -  5      e)Nz3Dialect '%s' does not support empty set expression.r  r  element_typesr  s      r   r	   SQLCompiler.visit_empty_set_expr  s$    !All 
 	
r   c                |  ^ ^^	^
 TR                   R                  T R                  5      nU(       d  UR                  (       aT  T R                  R                  (       a  SOST R                  TR                   R                  TR                  5      -   nSU4$ T R                  TR                   /TR                  5      n SU4$ UR                  (       dQ  UR                  (       a  [        US   [        R                  5      (       a  [        US   [        [        45      (       de  UR                  (       a  [        S5      eT R                  R                  (       a  SOSSR!                  UU 4S j[#        U5       5       5      -   nSU4$ U(       a  T R$                  nUR'                  U5      nU(       a  UR)                  S5      (       d   S5       eUR)                  S5      R+                  S	5      nUS
   US   sm	m
SR!                  U	U
UU 4S jU 5       5      nSU4$ SR!                  UU 4S jU 5       5      nSU4$ )NVALUES r  r   z?bind_expression() on TupleType not supported with literal_bindsr   c           	   3     >#    U  HC  u  pS SR                  U4S j[        UTR                  R                  5       5       5      -  v   ME     g7f)rU  r   c              3  J   >#    U  H  u  pTR                  X5      v   M     g 7fr  r  )r-  r  
param_typer  s      r   r/  [SQLCompiler._literal_execute_expanding_parameter_literal_binds.<locals>.<genexpr>.<genexpr>  s-      2-E 11%DD2r  N)rw   r  r   r  )r-  r!  r"  rI  r  s      r   r/  QSQLCompiler._literal_execute_expanding_parameter_literal_binds.<locals>.<genexpr>  sQ       ):$A II 14)9>>+?+?2  ):s   AAr6   )unexpected format for expanding parameterr-  r   r  c              3  n   >#    U  H*  nT< TR                  UTR                  5      < T< 3v   M,     g 7fr  r  r   )r-  r  r0  r1  rI  r  s     r   r/  r    s8      3 "(	  11%H 	 "(   25c              3  \   >#    U  H!  nTR                  UTR                  5      v   M#     g 7fr  r  )r-  r  rI  r  s     r   r/  r    s,      3!' --eY^^DD!'s   ),r   )r   r  r  r  tuple_in_valuesr  r  r
  _isnullr  collections_abcr   r   bytes_has_bind_expressionr  rw   r   r?  searchr   r3  )r  rI  r  bind_expression_templatetyp_dialect_implreplacement_expressionpost_compile_patternr  r5  r0  r1  s   ``       @@r   2_literal_execute_expanding_parameter_literal_binds>SQLCompiler._literal_execute_expanding_parameter_literal_binds  s"    %>>AA$,,O
  ..!%!=!=I200NN(()*=*=*&z )))m *.)E)E^^$i&9&9*&l )))e ,,$$6!9o&>&>??vay3,7744)$  "\\99	r		  )2&(9 &"N )))1 ('+'A'A$(//0HIQWW  ?>?  ggaj&&t,$'FCF!)- 3 "(3 *& ))) *. 3!'3 *&
 )))r   c                  ^ ^^
^^^ TR                   (       a  T R                  TU5      $ T R                  nTR                  R	                  U5      mT R
                  (       a  T R                  mOT R                  mT R                  R                  (       a  TR                  (       a
  UUU U4S jm
OU4S jm
U(       ds  / mTR                  (       a4  T R                  TR                  R                  TR                  5      nTU4$ T R                  TR                  /TR                  5      n TU4$ TR                  (       dQ  TR                  (       a  [        US   [         R"                  5      (       a  [        US   [$        [&        45      (       d  TR(                  (       a   e[+        US5       VVVV	s/ s H*  u  pg[+        US5        H  u  pU< SU< SU< 3U	4PM     M,     sn	nnnmUR,                  (       a  SOSSR/                  U
U4S	 j[+        U5       5       5      -   nTU4$ [+        US5       VV	s/ s H  u  piU< SU< 3U	4PM     sn	nmSR/                  U
4S
 jT 5       5      nTU4$ s  sn	nnnf s  sn	nf )Nc                H   > TR                  TR                  TTSU 0-  5      $ Nr   )render_bind_castr   )r   bind_templaterI  r  r$  s    r   _render_bindtemplateNSQLCompiler._literal_execute_expanding_parameter.<locals>._render_bindtemplate  s,    ,,NN$!VTN2 r   c                   > TSU 0-  $ r+  r   )r   r-  s    r   r.  r/    s    $~55r   r   r   r4  r  r  r   c              3     >^^#    U  H2  u  mmS SR                  UUUU4S j[        T5       5       5      -  v   M4     g7f)rU  r   c              3  b   >#    U  H$  u  pT" TT[        T5      -  U-      S    5      v   M&     g7f)r   N)r  )r-  r#  r  r.  r!  rJ  r"  s      r   r/  MSQLCompiler._literal_execute_expanding_parameter.<locals>.<genexpr>.<genexpr>  sF       )AHA -%a#m*<&<q&@A!D  )A   ,/N)rw   r   )r-  r!  r"  r.  rJ  s    @@r   r/  CSQLCompiler._literal_execute_expanding_parameter.<locals>.<genexpr>	  sF       ):$A} II  )2-(@	  ):s   :?c              3  8   >#    U  H  u  pT" U5      v   M     g 7fr  r   )r-  r.  r  r.  s      r   r/  r5    s      /<Ejc$S))Irh  )r=  r'  r  r   r  rU  rO  rN  _bind_typing_render_castsr,  r  r  r  r
  r  r  r  r   r   r   	_is_arrayr   r  rw   )r  r   rI  r  r  r%  r!  r"  r#  r  r.  r-  rJ  r$  s   ` `       @@@@r   r<  0SQLCompiler._literal_execute_expanding_parameter  sO   $$JJ6  ,,$>>AA'J 99M --M LL22 11 6 I..)-)E)ENN(()*=*=*&V 000O *.)E)E^^$i&9&9*&N 000G ,,$$6!9o&>&>??vay3,77'1111 )2&!(<(<$A )- ;HA  $Q*E2 ; 3(<I %44	"		  )2&(9 &". 000 !*&! 4 4HA !!$e, 4I &*YY /<E/ &" 000;*s   71I6
<I>c           	        U(       Ga
  [         R                  " UR                  5      (       a  Ubx  US   nUR                  R	                  [
        R                  " [        UR                  R                  U/-   5      [        UR                  R                  U/-   5      5      5        OjUR                  R	                  [
        R                  " [        UR                  R                  5      [        UR                  R                  5      5      5        U R                  (       aW  [        UR                  [        R                  5      (       a.  [        UR                  [        R                  5      (       a  SUS'   U=(       d    UR                  nU R                  USS 5      n	U	(       a	  U	" X40 UD6$  [         U   n
U R"                  " UU
4UUS.UD6$ ! [$         a  n[&        R(                  " X5      UeS nAff = f)Nenclosing_lateralTr=  r   )from_linterlateral_from_linter)r!   is_comparisonrs  r{  r  r  productr)   rx   r*   r   rM  r  r   rE   ra  r  r  r  r7   r  )r  r   r  eager_groupingr<  r=  r  r;  rb  rc  rd  r  s               r   r  SQLCompiler.visit_binary   s    9226??CC".$&':$;!#))00%%!"KK559J8KK ""LL66:K9LL		 !!((%%!&++";";<!&,,"<"<=   6;;(>(>??6<<)?)?@@$(B !%8	**9hE0R00$Y/ 44 !,(;	
    P55dFCOPs   4	G 
G:G55G:c                <    U R                   " UR                  40 UD6$ r  )r  sql_functionr  s       r   &visit_function_as_comparison_op_binary2SQLCompiler.visit_function_as_comparison_op_binaryX  s    ||G007B77r   c                0   U R                   R                  (       a>  U R                  " UR                  40 UD6S-   U R                  " UR                  40 UD6-   $ U R                  " UR                  40 UD6S-   U R                  " UR                  40 UD6-   $ )Nz %% r   )r  r  r  rx   r   r  s       r   visit_mod_binarySQLCompiler.visit_mod_binary[  s    ==))V[[/B/,,v||2r23 V[[/B/,,v||2r23r   c                    UR                   US'   U R                  " USU R                  UR                  5      -   S-   40 UD6$ )Nr@  r<  )r@  r  r  rd  r  s       r   visit_custom_op_binary"SQLCompiler.visit_custom_op_binaryi  sQ    '66,,$,,X->->??#E
 
 	
r   c                `    U R                   " XR                  UR                  5      S-   40 UD6$ r[  )r  r  rd  r  s       r   visit_custom_op_unary_operator*SQLCompiler.visit_custom_op_unary_operatorq  s6    44//0A0ABSH
LN
 	
r   c                b    U R                   " USU R                  UR                  5      -   40 UD6$ r[  )r  r  rd  r  s       r   visit_custom_op_unary_modifier*SQLCompiler.visit_custom_op_unary_modifierv  s8    44S455h6G6GHH
LN
 	
r   c                    UR                  SS5      nSUS'   UR                  US'   UR                  R                  " U 4SU0UD6U-   UR                  R                  " U 4SU0UD6-   nU(       a  U(       a  SU-  nU$ )Nr`  FT
_binary_opr@  rU  )r  rs  rx   r  r   )r  r   rd  r@  r  r`  r  s          r   r  $SQLCompiler._generate_generic_binary{  s     #%&&)BE"J(,$%!??<KK**%379  ll--%379	 	 #~D=Dr   c                @    X!R                   R                  " U 40 UD6-   $ r  r  r  r  rd  r  s       r   r  ,SQLCompiler._generate_generic_unary_operator  s    --::4F2FFFr   c                B    UR                   R                  " U 40 UD6U-   $ r  r  rV  s       r   r  ,SQLCompiler._generate_generic_unary_modifier  s!    }}//;;hFFr   c                H    [         R                  " S[        R                  S9$ )Nz'%')r  )r   literal_columnr%   
STRINGTYPEr3  s    r   _like_percent_literal!SQLCompiler._like_percent_literal  s    &&uH4G4GHHr   c                D    SUR                   R                  " U 40 UD6 S3$ )Nzlower(r7  r  r  s      r   $visit_ilike_case_insensitive_operand0SQLCompiler.visit_ilike_case_insensitive_operand  s&    ::4F2FGqIIr   c                    UR                  5       nU R                  nUR                  UR                  5      R                  U5      Ul        U R                  " X40 UD6$ r  _cloner]  concatr   visit_like_op_binaryr  r   rs  r  percents        r   visit_contains_op_binary$SQLCompiler.visit_contains_op_binary  sM    ,,~~fll3::7C((@R@@r   c                    UR                  5       nU R                  nUR                  UR                  5      R                  U5      Ul        U R                  " X40 UD6$ r  rd  r]  re  r   visit_not_like_op_binaryrg  s        r   visit_not_contains_op_binary(SQLCompiler.visit_not_contains_op_binary  sM    ,,~~fll3::7C,,VDDDr   c                   UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      R	                  U5      Ul        U R                  " X40 UD6$ r  rd  r]  r  rx   re  r   visit_ilike_op_binaryrg  s        r   visit_icontains_op_binary%SQLCompiler.visit_icontains_op_binary  sh    ,,,V[[9~~"6<<0

&/ 	 ))&AbAAr   c                   UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      R	                  U5      Ul        U R                  " X40 UD6$ r  rd  r]  r  rx   re  r   visit_not_ilike_op_binaryrg  s        r   visit_not_icontains_op_binary)SQLCompiler.visit_not_icontains_op_binary  sh    ,,,V[[9~~"6<<0

&/ 	 --fE"EEr   c                    UR                  5       nU R                  nUR                  UR                  5      Ul        U R                  " X40 UD6$ r  )rd  r]  _rconcatr   rf  rg  s        r   visit_startswith_op_binary&SQLCompiler.visit_startswith_op_binary  sD    ,,''5((@R@@r   c                    UR                  5       nU R                  nUR                  UR                  5      Ul        U R                  " X40 UD6$ r  )rd  r]  r{  r   rm  rg  s        r   visit_not_startswith_op_binary*SQLCompiler.visit_not_startswith_op_binary  sD    ,,''5,,VDDDr   c                    UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      Ul        U R                  " X40 UD6$ r  )rd  r]  r  rx   r{  r   rr  rg  s        r   visit_istartswith_op_binary'SQLCompiler.visit_istartswith_op_binary  sZ    ,,,V[[9''(>v||(LM))&AbAAr   c                    UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      Ul        U R                  " X40 UD6$ r  )rd  r]  r  rx   r{  r   rw  rg  s        r   visit_not_istartswith_op_binary+SQLCompiler.visit_not_istartswith_op_binary  sZ    ,,,V[[9''(>v||(LM--fE"EEr   c                    UR                  5       nU R                  nUR                  UR                  5      Ul        U R                  " X40 UD6$ r  rc  rg  s        r   visit_endswith_op_binary$SQLCompiler.visit_endswith_op_binary  sB    ,,~~fll3((@R@@r   c                    UR                  5       nU R                  nUR                  UR                  5      Ul        U R                  " X40 UD6$ r  rl  rg  s        r   visit_not_endswith_op_binary(SQLCompiler.visit_not_endswith_op_binary  sB    ,,~~fll3,,VDDDr   c                    UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      Ul        U R                  " X40 UD6$ r  rq  rg  s        r   visit_iendswith_op_binary%SQLCompiler.visit_iendswith_op_binary  sX    ,,,V[[9~~&<V\\&JK))&AbAAr   c                    UR                  5       nU R                  n[        UR                  5      Ul        UR	                  [        UR
                  5      5      Ul        U R                  " X40 UD6$ r  rv  rg  s        r   visit_not_iendswith_op_binary)SQLCompiler.visit_not_iendswith_op_binary  sX    ,,,V[[9~~&<V\\&JK--fE"EEr   c                   UR                   R                  SS 5      nUR                  R                  " U 40 UD6< SUR                  R                  " U 40 UD6< 3Ub%  SU R                  U[        R                  5      -   -   $ S-   $ )Nro  z LIKE  ESCAPE r  	modifiersr  rx   r  r   r  r%   r\  r  r   rs  r  ro  s        r   rf   SQLCompiler.visit_like_op_binary  s    !!%%h5 KK**4626LL++D7B7

 ! 2268;N;NOO	
 	
 
 	
r   c                   UR                   R                  SS 5      nUR                  R                  " U 40 UD6< SUR                  R                  " U 40 UD6< 3Ub%  SU R                  U[        R                  5      -   -   $ S-   $ )Nro  z
 NOT LIKE r  r  r  r  s        r   rm  $SQLCompiler.visit_not_like_op_binary  s    !!%%h5KK**4626LL++D7B7

 ! 2268;N;NOO	
 	
 
 	
r   c                    U[         R                  L aD  UR                  5       n[        UR                  5      Ul        [        UR
                  5      Ul        U R                  " X40 UD6$ r  )r!   ilike_oprd  r  rx   r   rf  r  s       r   rr  !SQLCompiler.visit_ilike_op_binary  sS    y)))]]_F0=FK1&,,?FL ((@R@@r   c                    U[         R                  L aD  UR                  5       n[        UR                  5      Ul        [        UR
                  5      Ul        U R                  " X40 UD6$ r  )r!   not_ilike_oprd  r  rx   r   rm  r  s       r   rw  %SQLCompiler.visit_not_ilike_op_binary  sS    y---]]_F0=FK1&,,?FL ,,VDDDr   c                r    UR                   R                  SS5      nU R                  " X(       a  SOS40 UD6$ )Nr   Fz BETWEEN SYMMETRIC z	 BETWEEN r  r  r  r  r   rs  r  r   s        r   visit_between_op_binary#SQLCompiler.visit_between_op_binary  s?    $$((e<	,,Y)K
KM
 	
r   c                t    UR                   R                  SS5      nU R                  " UU(       a  SOS40 UD6$ )Nr   Fz NOT BETWEEN SYMMETRIC z NOT BETWEEN r  r  s        r   visit_not_between_op_binary'SQLCompiler.visit_not_between_op_binary  sB    $$((e<	,,)2%
 
 	
r   c                \    [         R                  " SU R                  R                  -  5      eNz/%s dialect does not support regular expressionsr7   r  r  r   r  s       r   visit_regexp_match_op_binary(SQLCompiler.visit_regexp_match_op_binary&  *    =ll 
 	
r   c                \    [         R                  " SU R                  R                  -  5      er  r  r  s       r    visit_not_regexp_match_op_binary,SQLCompiler.visit_not_regexp_match_op_binary,  r  r   c                \    [         R                  " SU R                  R                  -  5      e)Nz;%s dialect does not support regular expression replacementsr  r  s       r   visit_regexp_replace_op_binary*SQLCompiler.visit_regexp_replace_op_binary2  s*    Ill 
 	
r   c           	        U(       Gd  UR                   R                  U R                  5      nUR                  (       a  UR	                  U5      n	U R
                  " U	4SUU=(       a    UR                  (       + UUS.UD6n
UR                  (       a  [        R                  " SU
5      nU(       d   S5       eSUR                  S5      < SUR                  S5      < S	UR                  S
5      < S3n
U(       a  U R                  " U4SU
S.UD6nSU-  $ U
$ U(       dG  U=(       d(    UR                  =(       d    U=(       a    U R                  nU=(       d    UR                  nOSnU(       a-  U R                  " U4SS0UD6nUR                  (       a  SU-  nU$ U R                  U5      nXR                  ;   Gac  U R                  U   nXLGaO  UR                  (       d  UR                  (       am  UR                   R#                  UR                   5      (       dC  UR$                  R#                  UR$                  5      (       d  [&        R(                  " SU-  5      eUR                  UR                  :w  a  [&        R(                  " SU< S35      eUR*                  (       d  UR*                  (       ai  UR*                  (       a'  UR*                  (       a  [&        R(                  " S5      e[&        R(                  " SUR,                   SUR,                   S35      eU=U R                  UR,                  '   U R                  U'   U R.                  nU(       aM  Uu  nnUR$                   H8  nUR,                  U;   d  M  UUR,                     nUU   R1                  U5        M:     UR2                  (       a  SU l        U(       aB  U(       a  SU l        U(       a  U =R8                  U1-  sl        OU =R:                  U1-  sl        U R<                  " U4UUR                  UR                   S.UD6nUR                  (       a  SU-  nU$ )NT)skip_bind_expressionr  literal_bindsr=  render_postcompilez&^(.*)\(__\[POSTCOMPILE_(\S+?)\]\)(.*)$r  z(__[POSTCOMPILE_r6   r-  r   z~~REPL~~r  z~~]))r  r#  rU  Fr  zIBind parameter '%s' conflicts with unique bind parameter of the same namez"Can't reuse bound parameter name 'z' in both 'expanding' (e.g. within an IN expression) and non-expanding contexts.  If this parameter is to receive a list/array value, set 'expanding=True' on it for expressions that aren't IN, otherwise use a different parameter name.a)  Encountered unsupported case when compiling an INSERT or UPDATE statement.  If this is a multi-table UPDATE statement, please provide string-named arguments to the values() method with distinct names; support for multi-table UPDATE statements that target multiple tables for UPDATE is very limitedzbindparam() name 'z' is reserved for automatic usage in the VALUES or SET clause of this insert/update statement.   Please use a name other than column name when using bindparam() with insert() or update() (for example, 'b_z').)post_compile	expandingbindparam_type)r   dialect_implr  r!  bind_expressionr  r  rn  rv  r   r;  r=  rM  _truncate_bindparamrI  r   r  intersectionr  r7   r  _is_crudr.  ra  r  
isoutparamhas_out_parametersrV  r^  r_  r  )r  r  r  r  r  r=  r  r  implr  wrappedr  r  r  r   existingr  r  r  r  r  s                        r   visit_bindparamSQLCompiler.visit_bindparam8  s    $>>..t||<D(("&"6"6y"A,,#)-*?"/"K	8K8K4K$3'9  && A7A III1


G %";;%265< %	  &|+ D,,D)Bd.B.B 
 +Ai.A.AL L//159?C ""slJ''	2::zz$'H(__	(8(8$..;;!++  %00==!--  **ACGH  ''9+>+>>** :>@  &&)*<*<((Y-?-? "..&
 
 "..0 @" #,--5	 	 8A@

9==!DJJt$4 //
#JD$++66T>bffBHOOI. ,
 &*D#!+/(++	{:+((YK7(##
%))$>>	

 
 3,C
r   c                    [        5       er  r  )r  r  
dbapi_typer  s       r   r,  SQLCompiler.render_bind_cast  s    !##r   c                   U[         La  UnOUR                  c  UR                  c  UR                  SS 5      nU(       aF  U[        R
                  [        R                  4;  a"  [        R                  " SUR                  45        U R                  " [        R                  40 UD6$ UR                  nUR                  (       a  U R                  nU" UUUS9u  pU	$ U R!                  XQR"                  5      $ )NrS  zBound parameter '%s' rendering literal NULL in a SQL expression; comparisons to NULL should not use operators outside of 'is' or 'is not')r#  )r.   r  r  r  r!   is_is_notr&   warn_limitedr.  r  r%   r  r  r  r'  r  r   )
r  r  r  r#  r  r  opleeprJ  rL  s
             r   r;  $SQLCompiler.render_literal_bindparam  s      v-(E&9+=+=+EVVL$/"Y]]I4D4D$EE%%@ #(	 ||H$5$5<<<--EJJD*.)A+'I
 $#,,UNNCCr   c                   Uc>  UR                   (       d-  U R                  [        R                  R	                  5       5      $ UR                  U R                  5      nU(       a	   U" U5      $ [        R                  " S[        R                  " U5       SU 35      e! [         a7  n[        R                  " S[        R                  " U5       SU S35      UeSnAff = f)zRender the value of a bind parameter as a quoted literal.

This is used for statement sections that do not accept bind parameters
on the target driver/database.

This should be implemented by subclasses using the quoting services
of the DBAPI.

Nz Could not render literal value "z" with datatype z); see parent stack trace for more detail.z:No literal value renderer is available for literal value ")should_evaluate_noner  r   Null	_instance_cached_literal_processorr  r  r7   r  sql_util_repr_single_value)r  r  r  	processores        r   r   SQLCompiler.render_literal_value  s     =!;!; << 7 7 9::33DLLA		 '' ""//67 8!!&)   && 33E:; <%g ## s   %B 
C'2CCc                    XR                   ;   a  U R                   U   $ UR                  n[        U[        R                  5      (       a  U R                  SU5      nX R                   U'   U$ )Nr  )rJ  r.  r  r   rD   r  )r  r  r  s      r   r  SQLCompiler._truncate_bindparam&  s]    '??9--MM	i!:!:;;22;	JI &/	"r   c                   X4U R                   ;   a  U R                   X4   $ UR                  U R                  5      n[        U5      U R                  S-
  :  a]  U R
                  R                  US5      nUS[        U R                  S-
  S5       S-   [        U5      SS  -   nUS-   U R
                  U'   OUnXPR                   X4'   U$ )N   r   r   r4  r6   )	r  	apply_mapr  r  r  r  r  maxhex)r  ident_classr   anonnamecounter	truncnames         r   r  !SQLCompiler._truncated_identifier3  s     $"6"66''(;<<>>$--0x=4,,q00..22;BGS!2!2Q!6:;g,qr"# 
 5<aKD$$[1 I4=k01r   c                    XR                   -  $ r  r  r  r   s     r   
_anonymizeSQLCompiler._anonymizeH  s    mm##r   c                &  ^  Ub  UR                  U5        Ub  UR                  U5        U(       dD  T R                  R                  U5      (       a$  T R                  R	                  U 4S jU5      n	UnU	nU(       a!  T R
                  R                  XA05      T l        U(       aQ  SU-  n
U(       a  U
$ Ub>  UR                  T R                  5      nUR                  (       a  T R                  X[U
5      n
U
$ T R                  [        R                  L a  T R                  SU0-  n
OT R                  SU0-  n
UbY  T R                  R                   (       a>  UR                  T R                  5      nUR                  (       a  T R                  X[U
5      n
U
$ )Nc                @   > TR                   U R                  S5         $ )Nr   )r?  r   )r  r  s    r   r  .SQLCompiler.bindparam_string.<locals>.<lambda>e  s    d88Dr   z__[POSTCOMPILE_%s]r   )addr  r>  r"  r  r`  r   r  r  render_literal_castr,  r  rf  rg  rO  rN  r7  )r  r   r  r  escaped_fromr  accumulate_bind_namesvisited_bindparamr  new_namer  	type_impls   `           r   r  SQLCompiler.bindparam_stringK  sp    !,!%%d+($$T*&&--d33  2266D  $&*&=&=&C&C$'D# &-C 
 )*BBLL	 00//3OCJZZ=222//64.@C##vtn4C &66&>>t||LI))++NsK
r   c                    UR                  5       nUR                  SS 5        [        UR                  UR                  5       H  u  pEUR
                  " U 4SU0UD6  M     g )Ncte_opts)copyr}  r  r  _independent_ctes_optsr  )r  stmtr  local_kwcteopts         r   r  &SQLCompiler._dispatch_independent_ctes  sW    779Z&""D$?$?
HC ""4B#BB
r   c                  ^  T R                  5       n	U	T R                  L d   eXS'   UR                  n
[        U
[        R
                  5      (       a  T R                  SU
5      n
SnSnUR                  5       nUR                  =(       d    UR                  nUT R                  ;   a  T R                  U   u  nnnUU
:X  d   eX4nT R                  U   nUR                  (       a|  UR                  (       a  [        R                  " S5      eX4nU(       a  [        T R                  5      OSnX4=nnT R                  U	 UT R                  U'   UU4-   T R                  U'   OCU(       a  [        T R                  5      OSnX4nUT R                  ;   a  T R                  U   nOS nUb  UUL nUUR                  L d  UUL a  SnOUUR                  L a/  U	U	 UR                  5       nUUL d   eUUL d   eT R                  U	 OLUR                   c  UR                   b  UR#                  U5      (       a  SnO[        R                  " SU
-  5      eU(       d  U(       d  g UR$                  bT  UR$                  nUR$                  R                  n[        U[        R
                  5      (       a  T R                  SU5      nOUnS nU(       Ga  UT R                  U'   UU4-   T R                  U'   UT R                  ;  a  T R&                  " U40 UD6  U(       Gd  X;  Ga{  UR(                  (       a  ST l        T R,                  R/                  X5      nUR(                  (       an  UR0                  nUR3                  S5       VVVVVs/ s H  u  nnnnnU(       a  M  U=(       d    UPM     nnnnnnUSS	R5                  U 4S
 jU 5       5      -  -  nUR7                  SS5      SL d   eT R                  (       d  UR0                  R8                  " T 4SU0UD6$ T R:                  " XR<                  40 UD6n UR0                  R8                  " T 4SS0UD6n!USU < SU!< S3-  nUR>                  (       a#  UST R:                  " XR>                  40 UD6-   -  nUX'   U(       a  U(       a  XR@                  URC                  5       '   U(       d"  U(       a  T R,                  R/                  X5      $ U(       am  T R,                  R/                  UU5      nT R,                  RE                  U
5      (       a  T R,                  RG                  U
5      n
UT RI                  U
5      -  nU$ T R,                  R/                  X5      $ g s  snnnnnf )Nvisiting_cter  TFz6CTE is stated as 'nest_here' in more than one locationr   z5Multiple, unrelated CTEs found with the same name: %rrU  r   c              3  l   >#    U  H)  nTR                   R                  UTR                  S 9v   M+     g7f)r  N)r  format_label_namer  )r-  identr  s     r   r/  (SQLCompiler.visit_cte.<locals>.<genexpr>-  s9      " *4 !MM;; % <  *4s   14subqueryr  r   z
(r7  r<  )%r  re  r   r  r   rD   r  _get_reference_ctenestingrg  rf  r7   r  r  r  	_restates_is_clone_ofcompare
_cte_alias	visit_cte	recursiverh  r  format_aliasr  _generate_columns_plus_namesrw   r  r  _generate_prefixes	_prefixes	_suffixesrz  r)   _requires_quotesr  get_render_as_alias_suffix)"r  r  r  ashint	fromhintsr  r<  r  r  	self_ctescte_name
is_new_cteembedded_in_current_named_cte_reference_cter	  	cte_levelr4  existing_cte_optscte_level_nameexisting_cteold_level_namenew_level_nameexisting_cte_reference_ctepre_alias_ctecte_pre_alias_namer  
col_source
proxy_namefallback_label_namer  repeated
recur_colsprefixesr   s"   `                                 r   r  SQLCompiler.visit_cte  s{    ((*	DII%%%!$~88h 9 9::11'8DH
(-%//1++1!1!1 T333.2.D.D/+Iq+ = ='2N22>BL
 $,,**1 
 #,!6/6C

OA	3<2GG++N;:F''79GK :&&~6
 ,3DJJI'2N!8!88#66~F##,8L,H) l,,,|0C"
. l+-9-L-L-N*1^CCC1\AAA**+EF $$0#00<kk,//!&J**,.67 
 j>>%NNM!$!4!4,h.G.GHH%)%?%?/&"  M!%69D##N35CG 6D"">2 DII-}77%#*>==*.D'}}11#@==!$J" )EEdK" L&/$' :+9z9 L  "  F		 " *4	"  D zz*e4===zz ;;99%+/5   $66]] .4 H  KK::%)-3E h>>D==C$"9"9]]#.4#  D "&	5=!!#--/2"?}}11#@@!}}11#7IJ==11(;;#}}228<H77AA}}11#@@G"s   U:U:c                    UR                   (       a  S US'   UR                  (       a  U R                  " U40 UD6$ U R                  " U40 UD6$ )Nr<  )joins_implicitly_is_lateralvisit_lateralvisit_aliasr  s      r   visit_table_valued_alias$SQLCompiler.visit_table_valued_aliasa  sJ    ## $B}%%g444##G2r22r   c                (    U R                   " U40 UD6$ r  )r  r  s      r   visit_table_valued_column%SQLCompiler.visit_table_valued_columni  s      /B//r   c
           
     t  ^ ^^
 U(       a6  ST
;  a  TR                   (       d   eTT
S'   U	(       a  ST
;  a  ST
;   a  U	T
S'   UbQ  UR                  TL aB  TR                  R                  " T 4UUUUUTS.T
D6nU(       a  U(       d  U(       a  SU< S3nU$ T=nT
S'   U(       d  U(       aR  [        TR                  [
        R                  5      (       a  T R                  STR                  5      nOTR                  nU(       a  T R                  R                  TW5      $ U(       a  U	(       a  WU	R                  TR                  5       '   TR                  R                  " T 4SUS	.T
D6nU(       a  SU< S3nUT R                  T R                  R                  TW5      5      -   nTR                  (       a>  TR                  (       a-  US
SR                  UU
U 4S jTR                    5       5      -  -  nU(       a  TU;   a  T R#                  UTUT   U5      nU$ TR                  R                  " T 4SU0T
D6$ )Nr;  r=  )r  r  iscrudr  lateralenclosing_aliasr6  r7  r;  r  T)r  r:  rU  r   c              3    >#    U  Hu  nTR                   R                  UR                  5      < TR                  (       a4  S TR                  R
                  R                  " UR                  40 TD6-  OS< 3v   Mw     g7f) %sr  N)r  r  r   _render_derived_w_typesr  r  r  r   )r-  r  r  r  r  s     r   r/  *SQLCompiler.visit_alias.<locals>.<genexpr>  sz       $+C !MM//9 $)#@#@	 !&"&,,"E"E"M"M$'HH#"06#"!"
 &(!(	 $+s   A=B r:  )r0  r  r  r  r   r   rD   r  r  r  rz  r)   r  _supports_derived_columns_render_derivedrw   r  format_from_hint_text)r  r  r  r  r9  r  r  r:  r;  r<  r  r   
alias_namer  s   ``        `   r   r2  SQLCompiler.visit_aliasl  s1    "&0 ((((.3*+
 )7'610;,-&?+B+Be+KMM44	# %	 	E Vw"')L:??Of%67V%**h&?&?@@!77L
"ZZ
==--eZ@@7A!!%//"34MM44!76<E "')$99**5*= C ..53H3HvII  $)77  $ Ui/00	% 0& J ==33%)/ r   c                2    SUS'   U R                   " U40 UD6$ )NTr  r2  )r  r  r  s      r   visit_subquerySQLCompiler.visit_subquery  s!    :/B//r   c                8    SUS'   SU R                   " U40 UD6-  $ )NTr:  z
LATERAL %srF  )r  lateral_r  s      r   r1  SQLCompiler.visit_lateral  s&    9d..x>2>>>r   c                    U R                   " U4SS0UD6< SUR                  5       R                  " U 40 UD6< 3nUR                  b#  USUR                  R                  " U 40 UD6-  -  nU$ )Nr  Tz TABLESAMPLE z REPEATABLE (%s))r2  _get_methodr  seed)r  tablesampler  r  r  s        r   visit_tablesampleSQLCompiler.visit_tablesample  s}    [<<<##%88DD

 '&  33D?B? D r   c                   ^ ^^ TR                  STR                  5        SR                  UUU 4S jTR                   5       5      nSU 3$ )Nr  r   c           	   3     >#    U  HN  nU  HD  nTR                   " [        R                  " US TR                  06R	                  5       40 TD6v   MF     MP     g7f)r  N)r  r   r   _column_typesr  )r-  chunkelemr  r  r  s      r   r/  -SQLCompiler._render_values.<locals>.<genexpr>  sb      	
 ' LL26!//*, 	  's   AAr  )
setdefaultr  rw   _data)r  r  r  tupless   ``` r   _render_valuesSQLCompiler._render_values  sG    
ow'<'<= 	
 !	
 	
 !!r   c           
     t  ^ ^ T R                   " U40 TD6nUR                  (       a  S nOR[        UR                  [        R
                  5      (       a  T R                  SUR                  5      nOUR                  nUR                  (       a  SnOSnU(       a  U(       a"  Ub  UOSUR                  UR                  5       '   U(       ae  STS'   U< SU< ST R                  T R                  R                  U5      5      < S	S
R                  UU 4S jUR                   5       5      < S3nU$ U< SU< S3nU$ )Nr  zLATERAL r  z(unnamed VALUES element)Fr  r6  r7   (r   c              3  J   >#    U  H  nUR                   " T40 TD6v   M     g 7fr  r  r?  s     r   r/  +SQLCompiler.visit_values.<locals>.<genexpr>  s(      "%4 00<<%4r  )r[  _unnamedr  r   r   rD   r  r0  rz  r)   r  r  r  rw   columns)r  r  r  r<  r  r  r   r:  s   `   `   r   visit_valuesSQLCompiler.visit_values  s   .2.Dh&?&?@@--hED<<D GG ,D2L !!'"3"3"56 &+?#33DMM4G4G4MN		 "%,__" 
  !(+r   c                0    SU R                   " U40 UD6 S3$ r  )r[  r  s      r   visit_scalar_valuesSQLCompiler.visit_scalar_values  s"    4&&w5"56a88r   c                    SU-   $ )Nr   r   )r  alias_name_texts     r   r  &SQLCompiler.get_render_as_alias_suffix  s    ''r   c                    U(       d   eUb  US:X  a  SU l         SU l        UR                  (       a  [        R                  " S5      eU R
                  R                  [        XX45      5        g )N*FTzxMost backends don't support SELECTing from a tuple() object.  If this is an ORM query, consider using the Bundle object.)rS  rR  r  r7   r  r  r  r   r  s        r   r  SQLCompiler._add_to_result_map  sg     w?gn$)D!#'D ""4 
 	##wg=	
r   c                :    U R                   " SUUSUc  0 OU40 UD6$ )a$  Render a column with necessary labels inside of a RETURNING clause.

This method is provided for individual dialects in place of calling
the _label_select_column method directly, so that the two use cases
of RETURNING vs. SELECT can be disambiguated going forward.

.. versionadded:: 1.4.21

NF)_label_select_column)r  r  r   r$  column_clause_argsr  s         r   _label_returning_column#SQLCompiler._label_returning_column8  s8     (($,B2D
 
 	
r   c                  ^^ TR                   R                  U R                  5      nUR                  (       a   U(       d  U(       a  UR	                  T5      nOTnU(       a+  U R
                  nU
(       a	  UmU4S jnOUTLa	  UmUU4S jnOSnU	(       d   S5       e[        T[        R                  5      (       a+  UTLa"  [        UTR                  TR                  4S9nGOuUnGOqU(       a#  Uc   S5       e[        UUUTR                  4S9nGOGUTLa  SnO[        T[        R                  5      (       a0  U=(       a&    TR                  (       + =(       a    TR                  SLnO[        T[        R                   5      (       a  SnOf[        T[        R"                  5      (       a  TR$                  =(       d    UnO1[        T[        R&                  5      (       d  TR(                  c  SnOSnU(       a_  U(       d  U
(       a   eTR*                  n[        U[        R,                  5      (       d  [        R,                  " U5      OUn[        XU4S9nOUnUR/                  U	UUS	9  UR0                  " U 40 UD6$ )
z.produce labeled columns present in a select().c                   > T" XU 4U5        g r  r   )r   r   r   r  r  s       r   r  ;SQLCompiler._label_select_column.<locals>.add_to_result_maps  s    &wwj%Hr   c                "   > T" XT4U-   U5        g r  r   )r   r   r   r  r  r   s       r   r  ru  {  s    &y7':Er   NzX_label_select_column is only relevant within the columns clause of a SELECT or RETURNING)r  z*proxy_name is required if 'name' is passedTF)r  r  r  )r   r  r  _has_column_expressioncolumn_expressionr  r  r   rH   r  r   r  r  rF   r  r   
TextClauseUnaryExpressionwraps_column_expressionNamedColumn_non_anon_label_anon_name_labelrD   r  r  )r  r   r   r$  r  rp  r   r(  r)  r  column_is_repeatedneed_column_expressionsr  r  col_exprr  result_exprrender_with_labelr  s     `               @r   ro   SQLCompiler._label_select_columnM  sv     {{''5&&#':--f5HH
 !% 7 7
 "%6"I
 '%6" !% % 	
:	
$ fhnn--v%+fkkfnn5F ' &<;<& ( $$K& v% %)!FH$9$9::  1"---1D0 "
 FH$7$788$)!FH$<$<==$*$B$B$Lf!
 vx';';<< **2$(!$)! *
  211*0*A*A' &+X-F-F  --.AB - $ ,j] '!!"7/' 	" 	

 --dI6HIIr   c                F    U R                  X#5      nU(       a  USU-   -  nU$ r[  )get_from_hint_text)r  r  r   hintr9  hinttexts         r   rB  !SQLCompiler.format_from_hint_text  s(    **57sX~%Gr   c                    g r  r   )r  byfromss     r   get_select_hint_text SQLCompiler.get_select_hint_text      r   c                    g r  r   r  r   r  s      r   r  SQLCompiler.get_from_hint_text  r  r   c                    g r  r   r  s      r   get_crud_hint_textSQLCompiler.get_crud_hint_text  r  r   c                $    SR                  U5      $ r[  rA  )r  
hint_textss     r   get_statement_hint_text#SQLCompiler.get_statement_hint_text   s    xx
##r   r  r  r  r  c                    U R                   (       + nU(       a  U R                  OU R                   S   nUR                  X5      nUS   nUS   n	U(       a(  U(       d!  UR                  UR	                  U	5      SS9n
U
$ UR                  UU	S9n
U
$ )Nr  r  r  r   explicit_correlate_fromsimplicit_correlate_froms)r  r  r  _get_display_froms
difference)r  select_stmtr  r:  r  r"  r  r  r  r  rz  s              r   _display_froms_for_select%SQLCompiler._display_froms_for_select
  s     zz>-5))4::b>#::;M 12^,'!44)8)C)C * *,	 5 E 	 "44)8)5 5 E r   translate_select_structurec	                  ^% Ub   S5       eSU	S'   UR                   " X40 U	D6n
U
R                  U	S'   U
R                  nU R                  (       + nU(       a  U R                  (       d  Xl        US L=(       d    UnU R
                  (       a>  U R
                  " U4SU0U	D6nXLa%  U
nUnUnUR                   " X40 U	D6n
U
R                  nU(       a  U R                  OU R                  S   nU=(       d+    UR                  SS5      =(       d    UR                  SS5      =nnU(       a  SnU(       d	  S	U	;   a  U	S		 U R                  XXXu5      nU	R                  5       nUR                  SSS
.5        SnUR                  (       a$  U R                  U5      u  nnU(       a  UUS-   -  nOS nUR                  (       a  U R                  X5        UR                  (       a   UU R                   " XR                  40 U	D6-  nUU R"                  " U40 U	D6-  nU
R$                   VVVVVs/ s H!  u  nnnnnU R'                  UUUUUUUUUUS9
PM#     snnnnn Vs/ s H
  nUc  M  UPM     nnU(       a  Ub  [)        [+        U
R$                   VVVVVs/ s H  u  nnnnnUPM     snnnnnWR$                   VVVVVs/ s H  u  nnnnnUPM     snnnnn5      5      m%U R,                   VVVV s/ s H)  u  nnnn [/        UU[1        U%4S jU 5       5      U 5      PM+     sn nnnU l        U R3                  UUU
UUUUU	5      nUR4                  (       a]  UR4                   V!V"s/ s H&  u  n!n"U!SU R6                  R8                  4;   d  M$  U"PM(     n#n!n"U#(       a  USU R;                  U#5      -   -  nU R<                  (       a>  U(       a  U(       a0  U(       d  [?        U R                  5      OS n$U RA                  U$S9U-   nURB                  (       a#  USU R                   " XRB                  40 U	D6-   -  nU R                  RE                  S5        U$ s  snnnnnf s  snf s  snnnnnf s  snnnnnf s  sn nnnf s  sn"n!f )NzpSQLAlchemy 1.4 requires use of the translate_select_structure hook for structural translations of SELECT objectsFr  r  r  r  r  r  r  )r  r  zSELECT r<  )r   r(  r)  r  r  c              3  F   >#    U  H  nTR                  X5      v   M     g 7fr  r_  )r-  or  s     r   r/  +SQLCompiler.visit_select.<locals>.<genexpr>  s     $F#QY]]1%8%8#   !rl  r  )#r  _ambiguous_table_name_mapr#  r  r  r  r  r  _setup_select_stackr  r  _hints_setup_select_hintsr  r  r  r  get_select_precolumnscolumns_plus_namesro  r  r  r  r   r2  _compose_select_body_statement_hintsr  r   r  re  r  r  r  r}  )&r  r  r  insert_intor  r!  select_wraps_forr:  r<  r  r  r"  is_embedded_selectnew_select_stmtcompile_state_wraps_forr  r$  r  rz  rp  r  	hint_textbyfromr   r(  r)  r   r*  r  inner_columnsr.  r  r  dialect_namehtper_dialectr  r  s&                                        @r   visit_selectSQLCompiler.visit_select.  s     ' 	
-	
' +0&'#::
!'
 33 	)* $--zz>D..!.+47F;
 **"==$*.4O 1*7'#. - + B B!)/! ,55-5))4::b>  >yy7?>yy5u=	
5 "'
 #':f'D*+((w
 $[[]!!$)EJ	
  $ 8 8 EIv	C'F((++K@  D++226< D 	**;A&AA. #55'& 6'# ))'&)(;'/,C * $ 6'
* -  	 
4 #3#?  +==	 >&/ $  >	$ 5GG	 H&/ $  H	I: .2-A-A	$ .B)CsE #u$F#$FF .B	$D  ((	
 '' +6*F*F*F&\2C):):#;; *F  
 d::;GGG 990H3;C

OM***G$ND  C$11226<  D 	

ry
@		$&s0   &(QQ"QQ:Q$,0Q-
#Q5Q5c                    UR                   R                  5        VVVs0 s H;  u  u  p#nUSU R                  R                  4;   d  M&  X$SUR	                  U SS90-  _M=     nnnnU R                  U5      nXe4$ s  snnnf )Nrl  r   T)r  )r  r  r  r   r  r  )r  r   r  r  r  r  r  s          r   r  SQLCompiler._setup_select_hints  s     /5mm.A.A.C
 /D* (3 1 122DEu//T/BCD D.C 	 
 --f5	  
s   %A9A9c           	        US   nUS   nUS:X  a  XS'   OmU(       af  US   n	[        U	R                  5      n
[        UR                  5      U
:w  a3  [        R                  " SSU
US-   [        UR                  5      4-  5      eU(       a'  U(       d   UR                  UR                  U5      SS9nOUR                  UUS9n[        [        U6 5      nUR                  U5      nUUUUS	.nU R                  R                  U5        U$ )
Nr  r  r   r  z}All selectables passed to CompoundSelect must have identical numbers of columns; select #%d has %d columns, select #%d has %dr   r   r  )r  r  r$   r  )r  r  r  r7   r  r  r  ro   r*   r   r  r  )r  r   r  r  r  r:  r!  r  r  r  numcolsrz  new_correlate_fromsall_correlate_fromsr#  s                  r   r  SQLCompiler._setup_select_stack  s9      12^,Q &*Z(H(889G=334?&&!
 &*F889			  '!44)8)C)C * *,	 5 E "44)8)5 5 E
 "-"78177H 02 *	*
	 	

)$r   c	                   USR                  U5      -  nU R                  [        -  (       a5  [        0 [	        5       5      n	U R                  [
        -  n
U(       a  Xl        OS n	Sn
U(       d  UR                  5       nU(       a  US-  nUR                  (       a;  USR                  U Vs/ s H  nUR                  " U 4SUU	S.UD6PM     sn5      -  nOLUSR                  U Vs/ s H  nUR                  " U 4SU	S.UD6PM     sn5      -  nOXR                  5       -  nUR                  (       a.  U R                  " UR                  4SU	0UD6nU(       a  USU-   -  nU
(       a  U	c   eU	R                  5         UR                  (       a  XR                  " U40 UD6-  nUR                   (       a,  U R                  " UR                   40 UD6nU(       a  US	U-   -  nUR"                  (       a  XR$                  " U40 UD6-  nUR&                  (       a  XR(                  " U40 UD6-  nUR*                  b  XR,                  " U40 UD6-  nU$ s  snf s  snf )
Nr   Fz 
FROM T)r  r  r<  r  r<  r<  z 
WHERE z	 
HAVING )rw   rz  rm  rq  ro   rn  r<  rstripr  r  r  _where_criteriarQ  r  _group_by_clausesr  _having_criteria_order_by_clausesr  r  r  _for_update_argfor_update_clause)r  r  r   r  r  rz  r  r"  r  r<  warn_lintingfts                r   r   SQLCompiler._compose_select_body;  sw    			-((<<44$R/K<<,6L#. K L ;;=DJD}}		 "'	 "'A ,, #'&,(3	
 % "'	  		 "' "'A ,, #'(3 %	 "'
 
 %%''D!!11&&4?CIA a'***##((:6::D""11''+1A q((##((:6::D****6<V<<D!!-**6<V<<Dq	s   *!I
% I
c                Z   ^ ^ SR                  UU 4S jU 5       5      nU(       a  US-  nU$ )Nr<  c              3     >#    U  H<  u  pUS ;   d  UTR                   R                  :X  d  M'  UR                  " T40 TD6v   M>     g7f))Nrl  N)r  r   r  )r-  prefixr  r  r  s      r   r/  1SQLCompiler._generate_prefixes.<locals>.<genexpr>  sF      
(0${*ldll>O>O.O 2F%%d1b1(0s
   &AArA  )r  r  r,  r  rk  s   `  ` r   r  SQLCompiler._generate_prefixes  s1     
(0
 

 cMFr   c                   U R                   (       d  gU(       a  US:  a  [        R                  " 5       n[        U R                   R	                  5       5       H~  nU R
                  UR                  5          u  pVnUR                  =(       d    UR                  nXQ:H  =(       d    U=(       a    XQS-   :H  n	U(       a  U	(       d  Mm  U R                   U   X4'   M     OU R                   nU(       d  g[        U Vs/ s H  oDR                  PM     sn5      n
U R                  U
5      S-   nUSR                  UR                  5        Vs/ s H  oPM     sn5      -  nUS-  nU(       a|  US:  av  [        UR	                  5       5       HY  nU R
                  UR                  5          u  pVnU R                   U	 U R                  XV4	 U R
                  UR                  5       	 M[     U$ s  snf s  snf )z
include_following_stack
    Also render the nesting CTEs on the next stack. Useful for
    SQL structures like UNION or INSERT that can wrap SELECT
    statements containing nesting CTEs.
r  r   r<  , 
z
 )re  r&   r  r  keysrg  r  r	  rg   r  get_cte_preamblerw   r  rf  )r  r  r  re  r  r  r  r  r	  is_rendered_levelrh  cte_texttxts                r   r  SQLCompiler._render_cte_clause  s    yy ]Q.##%DDIINN,-040F0F**,1-	X ++9)9)9$-$> %+N	Q=N0N "  $5 IIcN	 . 99Dt<tmmt<=((83>FKK > >??E]Q.DIIK(040F0F**,1-	X IIcN++Y,AB**3+A+A+CD )  = !?s   8G$G)
c                    U(       a  gg)NzWITH RECURSIVEWITHr   )r  r  s     r   r  SQLCompiler.get_cte_preamble  s    #r   c                x    UR                   (       a  [        R                  " SSS9  UR                  (       a  S$ S$ )zSCalled when building a ``SELECT`` statement, position is just
before column list.

a  DISTINCT ON is currently supported only by the PostgreSQL dialect.  Use of DISTINCT ON for other backends is currently silently ignored, however this usage is deprecated, and will raise CompileError in a future release for all backends that do not support this syntax.z1.4versionr   r  )_distinct_onr&   warn_deprecated	_distinctr  r   r  s      r   r  !SQLCompiler.get_select_precolumns  s:    
   3
  %..{6B6r   c                    U R                   " UR                  [        [        R                     40 UD6nU(       a  SU-   $ g)z5allow dialects to customize how GROUP BY is rendered.z
 GROUP BY r  )rC  r  r  r!   comma_op)r  r   r  group_bys       r   r  SQLCompiler.group_by_clause  sE     00$$i	0B0B&C
GI
 (**r   c                    U R                   " UR                  [        [        R                     40 UD6nU(       a  SU-   $ g)z5allow dialects to customize how ORDER BY is rendered.z
 ORDER BY r  )rC  r  r  r!   r  )r  r   r  r  s       r   r  SQLCompiler.order_by_clause  sE     00$$i	0B0B&C
GI
 (**r   c                    g)Nz FOR UPDATEr   r  s      r   r  SQLCompiler.for_update_clause  s    r   c                   UR                  S[        R                  " U5      S9 VVVVV	s/ s H#  u  nnnnn	U R                  " UUU4UU	UUS.UD6PM%     n
nnnnn	SSR	                  U
5      -   $ s  sn	nnnnf )NT)cols)r)  r  r   r(  
RETURNING r   )r  r   _select_iterablesrq  rw   )r  r  returning_colsr$  r  r   r(  r)  r   r*  rb  s              r   returning_clauseSQLCompiler.returning_clause	  s    2 22411.A 3 #
"# ((#	 %8#+%	 	 # 	 
, dii000-
s   *A/c                    SnUR                   b#  USU R                  " UR                   40 UD6-   -  nUR                  b5  UR                   c  US-  nUSU R                  " UR                  40 UD6-   -  nU$ )Nr  z
 LIMIT z

 LIMIT -1z OFFSET )_limit_clauser  _offset_clause)r  r   r  r  s       r   r  SQLCompiler.limit_clause)  s    +K$,,v/C/C"Jr"JJJD  ,##+%Jf.C.C!Jr!JJJDr   c                   Uc  UR                   nUR                  nOSSS.nSnUR                  bU  UR                  nU(       a&  UR                  U5      (       a  UR	                  5       nU R
                  " U40 UD6n	USU	-  -  nOU(       a  US-  nUbf  U(       a&  UR                  U5      (       a  UR	                  5       nUSU R
                  " U40 UD6< US   (       a  SOS< S	US
   (       a  SOS< 3-  nU$ )NF)rh  	with_tiesr  z
 OFFSET %s ROWSz
 OFFSET 0 ROWSz
 FETCH FIRST rh  z PERCENTz ROWS r  z	WITH TIESONLY)r  _fetch_clause_optionsr  _simple_int_clauserender_literal_executer  )
r  r   r  require_offset"use_literal_execute_for_simple_intr  fetch_clause_optionsr  offset_clause
offset_strs
             r   r  SQLCompiler.fetch_clause3  s    !//L#)#?#? /45#I   ,"11M2--m<< - D D Fm:r:J'*44D&&D#2--l;;+BBD\0R029=
2E3K@fL D
 r   c	                   U(       a  UR                   UR                  U'   U(       d  U(       Ga  U R                  R                  U5      n
U(       aL  U
(       aE  U R                  R	                  U
5      S-   U R                  R                  UR                  5      -   nOU R                  R                  UR                  5      nU
(       db  U(       a[  UR                  U;   aK  U R                  SXR                     5      nXR                  U R                  R                  S U5      5      -   nU(       a  X;   a  U R                  XXQ   U5      nU$ g)Nr9  r  r  )fullnamerz  r  r  r  r  r   r  r  r  rB  )r  r   r  r9  r  r  
use_schemar<  r  r  r  r  	anon_names                r   visit_tableSQLCompiler.visit_table\  s    ',~~Ke$V#}}>>uE.MM../?@mm))%**56  mm))%**5 )0

&>> $ : :!9**!E!I  ? ?224C! C U/00	 0& Jr   c                   U(       aj  UR                   R                  [        R                  " [	        UR
                  R                  5      [	        UR                  R                  5      5      5        UR                  (       a  SnOUR                  (       a  SnOSnUR
                  R                  " U 4SUS.UD6U-   UR                  R                  " U 4SUS.UD6-   S-   UR                  R                  " U 4SU0UD6-   $ )Nz FULL OUTER JOIN z LEFT OUTER JOIN z JOIN Tr   ON r<  )r{  r  r  r?  r)   rx   r*   r   ru   isouterr  onclause)r  rw   r  r<  r  	join_types         r   
visit_joinSQLCompiler.visit_join  s   $$!!dii556djj667 99+I\\+I III((!{>D  jj++!{>D	  mm.."-17	
r   c                *   UR                   R                  5        VVVs0 s H(  u  u  p4nUSU R                  R                  4;   d  M&  X5_M*     nnnnUR                  U;   a)  U R                  X!R                  XaR                     S5      nXb4$ s  snnnf )Nrl  T)r  r  r  r   r   rB  )r  r  
table_textr   r  r  dialect_hintss          r   _setup_crud_hintsSQLCompiler._setup_crud_hints  s     04{{/@/@/B
/B+ )3 1 122 E/B 	 

 ::&33JJjj(A4J ((
s   %BBc                   U R                   R                  nUR                  nUR                  nUc  gUR                  (       a'  U R
                  R                  UR                  S5      nO&U R                  R                  UR                  S5      nX%-  (       a  U$ UR                  (       a4  [        R                  " SUS    SU R                   R                   S35      eg)a  given a :class:`.Table`, return a usable sentinel column or
columns for this dialect if any.

Return None if no sentinel columns could be identified, or raise an
error if a column was marked as a sentinel explicitly but isn't
compatible with this dialect.

Nr   zColumn z@ can't be explicitly marked as a sentinel column when using the a   dialect, as the particular type of default generation on this column is not currently compatible with this dialect's specific INSERT..RETURNING syntax which can receive the server-generated value in a deterministic way.  To remove this error, remove insert_sentinel=True from primary key autoincrement columns; these columns are automatically used as sentinels for supported dialects in any case.)r  "insertmanyvalues_implicit_sentinel _sentinel_column_characteristicsrb  
is_autoinc_sentinel_col_autoinc_lookupr  default_characterization _sentinel_col_non_autoinc_lookupis_explicitr7   r1  r   )r  r   sentinel_optssentinel_characteristics	sent_colsbitmasks         r   _get_sentinel_column_for_table*SQLCompiler._get_sentinel_column_for_table  s     GG#(#I#I ,44	#..77;;(AA1G ;;??(AA1G "#// )))A, (><<$$% &@
@  r   c              #  L  ^ ^^@^A^B^C^D#    T R                   nUc   eUR                  (       d  S n	O[        R                  " UR                  6 n	[	        U5      n
UR
                  (       a   T R                  R                  (       d  SnSnOZT R                  R                  (       a6  U(       a4  T R                  (       a#  UR                  b  UR                  (       a  SnSnOSnSnU(       aS  [        [        S[        X#5      5      S5       H/  u  nu  p[        UUTU/U	(       a	  U	" U5      /O/ SUU
UU5
      v   M1     g U(       a*  [         R"                  " T R$                  R&                  US9nOS nUR(                  nU(       a  U" U5      nSU S3nUR+                  US5      nT R                  R,                  nU(       aA  [	        T R.                  5      n[	        UR0                  5      nUU-
  n[3        UUU-
  U-  5      n[        S	[5        U5      5      n[        S	[5        U5      5      nS nSnX-  X-  (       a  SOS
-   nUR0                  nUc   eU(       a'  U VVVVs/ s H  u  nnnnUUU" U5      U4PM     nnnnnS
=mCmDT R6                  (       d  T R8                  (       a  T R8                  mAO0 mA[;        US
   5      n UAU 4S jm@UR<                  (       a  Sn!OSn!SSR?                  U@4S jU 5       5       U! S3n"U RA                  UA4S jU 5       5      n#U RC                  U#5       Vs0 s H  nUUS
   U   _M     n$nSmBGOSn"[;        5       n#0 n$UR<                  (       a  SU S3mBOSU S3mB[;        5       n%UR0                   H  n&U%RE                  U&S   5        M     U%(       af  T RF                  n'U'c   e[        U'5       V(V)s1 s H  u  n(n)U)U%;   d  M  U(iM     n*n(n)[3        U*5      mC[I        U*5      S-   mD[	        U*5      TDTC-
  :X  d   eT RJ                  (       a;  [L        RN                  " T RP                  5      n+[L        RR                  " U+ S3STB5      mBU(       Ga  US
U n,US
U n-/ US
U& / US
U& U(       a  Un.O[	        U,5      n.T(       a0  U4S j[U        U.5       5        V/V0V1s/ s H  u  n/n0n1U/U0U14PM     nn0n/n1T R6                  (       Ga  URV                  n2U2[	        U,S
   5      :X  a  S=n3n4U,n5OU,S
   S TC n3U,S
   TDS  n4UCUD4S jU, 5       n5UR<                  (       a(  SR?                  UB4S j[        U,5       5       5      S S n6OTBU.-  S S n6T RJ                  (       a@  U2S
:  a:  U4(       a   eTCS-   n7U2U.-  U7-   n8[Y        U 4S j[U        U7U85       5       5      n9U6U9-  n6UR+                  SU65      n:[Y        [Z        R\                  R_                  U55      5      n;U3U;-   U4-   n;O/ n<U$Ra                  5       n;[        U,5       H  u  n=nU"R+                  S[c        U=5      5      n>UR<                  (       a  U>R+                  S[c        U=5      5      n>U<Re                  U>5        U;RE                  U# Vs0 s H  nU SU= 3UU   _M     sn5        M     UR+                  SSR?                  U<5      5      n:[        U:U;UU,U	(       a  U- V?s/ s H  n?U	" U?5      PM     sn?O/ U.UUUS5
      v   US-  nU(       a  GM  g g s  snnnnf s  snf s  sn)n(f s  sn1n0n/f s  snf s  sn?f 7f)NTFzKSequence[Tuple[_DBAPISingleExecuteParams, _MutableCoreSingleExecuteParams]]r   r  r6  r7  __EXECMANY_TOKEN__zList[Sequence[Any]]r   c                   > U  HG  nTR                  X"5      nUR                  TR                  SU0-  TR                  SU S30-  5      nMI     U$ )Nr   __EXECMANY_INDEX__)r  r   rN  )r  	formattedr.  r`  r  s      r   apply_placeholdersISQLCompiler._deliver_insertmanyvalues_batches.<locals>.apply_placeholders  se    C,00:C ) 1 1))VSM9))!cU*<#=>?!I   ! r   z, _IMV_VALUES_COUNTERr  r   c              3  <   >#    U  H  u    pnT" X25      v   M     g 7fr  r   )r-  r4  r-  	bind_keysr.  s       r   r/  @SQLCompiler._deliver_insertmanyvalues_batches.<locals>.<genexpr>  s'      62D.AqY #9882Ds   c              3  b   >#    U  H$  u      pU  H  nTR                  X35      v   M     M&     g 7fr  r_  )r-  r4  r1  r.  r`  s       r   r/  r2    s:      4*<&Aq!$C #&&s00$ 1*<r4  z, _IMV_VALUES_COUNTER), z), r  z\d+r  c              3  P   >#    U  H  nT  H  u  p#nU S U 3X44v   M     M     g7f)r4  Nr   )r-  ru  r.  len_r  generic_setinputsizess        r   r/  r2    s9      /%>E.CNCs  5%)45.C 6%>s   #&r   c              3  .   >#    U  H
  nUTT v   M     g 7fr  r   )r-  r  expand_pos_lower_indexexpand_pos_upper_indexs     r   r/  r2    s!      &!&A 01GH!&s   c              3  ^   >#    U  H"  u  pTR                  S [        U5      5      v   M$     g7f)_IMV_VALUES_COUNTERN)r   r   )r-  r!  r4  executemany_values_w_commas      r   r/  r2    s7        )9 7>> 5s1v  )9rl  c              3  D   >#    U  H  nTR                    U 3v   M     g 7fr  )rP  )r-  r!  r  s     r   r/  r2  4  s(      &!2A  >>?sC!2s    EXECMANY_INDEX__r;  __)3r\  rG  rs  r  r  r<  r  supports_default_metavaluesupports_multivalues_insertr  rE  rC  r   r   r  rK  	functoolspartialr  r  r=  r   insertmanyvalues_max_parametersrJ  r?  minr  rt  r`  ro   rI  rw   r  r  r  r(  r  rU  rn  ro  rP  r  rangerA  r2  r  r  from_iterabler  r   r  )Er  r#  r$  compiled_parametersr6  
batch_sizerB  r  imv_sentinel_from_params	lenparamsuse_row_at_a_time
downgradedrS  paramcompiled_paramrstimv_single_values_exprexecutemany_values
max_paramstotal_num_of_paramsnum_params_per_batchnum_params_outside_of_batchbatchescompiled_batchesrO  rT  r?  r  r.  r4  stall_keysimv_values_counterformatted_values_clausekeys_to_replacebase_parametersall_names_we_will_expandrV  r(  r  r   all_expand_positionsescapedrP  compiled_batchrR  new_keyr5  r  num_ins_paramsextra_params_leftextra_params_rightbatch_iteratorexpanded_values_stringr  ri   r  rL  rM  replaced_values_clausesr!  fmvr  r.  r`  r<  r8  r9  sE   `   `                                                           @@@@@r   !_deliver_insertmanyvalues_batches-SQLCompiler._deliver_insertmanyvalues_batches  s     $$&&$(!$,$7$7((%! 
O	t||'N'N !%J99#$$%%-1N1N
 !%J %J5>a
8 6115 -)G 1 /~>?+ 6. ##77%9C
 C!$!7!7%()?%@" !7 8:%%&8:NO	 \\AA
"%doo"6#&s'='=#> #&:: ( "==+,J ,d:.>?!4(;#<
 HL!/'AQ
 !33!--- +="*<&CdB c3t9b)*<  " ;<;!7&&%)%<%<"%'":a=)H! ''%<"%'"*+DII 62D6 - , ""!''#
 '33 4*<4 O $..??C Z]3''?   *,&&(#!eO O''.//GH + 011G0H-L*14$..(//Q8 / (".."... &/{%;(%;	T77 %; % (
 *--A)B&),-A)BQ)F&,--0FFGG ""))D$G$GH-/VVy$d,F.* Aj)E-a
;N$&GAj!-/Qz*%/"%(Z"$/%*+=%>/+/*s dC(/ ( + !$!B!B "Sq]2=??%(:%*N(-a1H2H(I%).q2H2I)J&&!&&N
 ++   )2%(8	   r.* 46HHr.* &&>A+=  2112Q6E(,>?%GC !& &!&uc!2& !I .Di-O*%.%6%6(*@&" ',OO11.A'#
 &)*() $ +-'&5&:&:&<# )% 0HAu199*CFC //!kk*?QH+2237'..>MNosC51#c
2oN !1 &/%6%6(II56&"
 )"#' - :HH2*2.H"'   MHI go"P:(D+x O Is_   I\$\ 
:B4\$.\B	\$
\\!C\$.\F7\$8\
A \$\\$>&\$c                  ^  UR                   " UT 40 UD6nUR                  nUb  X4S'   SnOT R                  (       + nU(       a7  ST l        T R                  (       d  UT l        T R
                  (       d  UT l        T R                  R                  [        5       [        5       US.5        SnS nT R                  (       a  Uc  / n[        R                  " T UUU4SU0UD6nT R                  (       aI  UbF  [        U5      nT R                  (       a*  T R                  b  T =R                  U-  sl        OUT l        UR                  n	U	(       d~  T R                  R                   (       dc  T R                  R"                  (       dH  T R                  R$                  (       d-  [&        R(                  " ST R                  R*                  -  5      eUR,                  (       a  T R                  R.                  (       d-  [&        R(                  " ST R                  R*                  -  5      eT R0                  (       d  UR2                  (       a'  UR4                  (       a  [&        R(                  " S	5      eUR                  n	OUR                  n	T R6                  n
T R                  R                   nS
nUR8                  (       a   UT R:                  " XR8                  40 UD6-  nUS-  nU
R=                  UR>                  5      nUR@                  (       a  T RC                  X5      u  pURD                  (       a  T RG                  X5        X-  nU	(       d  U(       d-  USSRI                  U	 VVs/ s H  u  p  oPM
     snn5      -  -  nURJ                  nS nS nSnT R0                  =(       d    UR2                  nU(       Ga  URL                  nUb  U(       d   eU	 VVVs0 s H  u  n  nnUU_M     nnnn/ nU H<  nUU;  a  S n  O3T RO                  U5      nUUU   ;  a  S n  OUR                  U5        M>     UcJ  T R                  RP                  [R        RT                  -  (       a  SnOUS   RV                  (       a   S5       e[Y        U5      [Y        U5      -   nT R[                  UUUS9nT R\                  (       a  USU-   -  nOS nUR^                  b  T R`                  " T R                  S   S   4SS0UD6nT Rb                  (       aU  T R                  Rd                  (       a:  U(       d  [        T R                  5      OS nUST Rg                  USS9< U< 3-  nGO$USU-  -  nGOU	(       dq  U(       aj  US-  nU(       a\  [i        ST R                  Rj                  [m        SU	5      UUR4                  URn                  S LUU(       a  [        U5      OSUS9	T l8        GOUR,                  (       a+  USSRI                  S URr                   5       5      < 3-  nGOfSRI                  [m        SU	5       VVs/ s H
  u    nnnUPM     snn5      nU(       Ga"  U(       a  T R                  RP                  [R        Rt                  -  (       a  URv                  (       d  SnT R                  RP                  [R        Rx                  -  n SRI                  S [{        U	5       5       5      n!U (       a%  SRI                  U 4S j[{        U	5       5       5      n"OU!n"USU" SU SU! S 3-  nOSnUS!U S"3-  n[i        SU[m        SU	5      UUR4                  URn                  S LUU(       a  [        U5      OSUUUS#9T l8        O	US!U S"3-  nURn                  b,  T R`                  " URn                  40 UD6n#U#(       a  USU#-   -  nU(       a  T R\                  (       d  USU-   -  nT Rb                  (       aL  T R                  Rd                  (       d1  U(       d  [        T R                  5      OS nT Rg                  USS9U-   nT R                  R}                  S5        U$ s  snnf s  snnnf s  snnf )$Nr  FTr  r   r  zWThe '%s' dialect with current database version settings does not support empty inserts.zcThe '%s' dialect with current database version settings does not support in-place multirow inserts.zcRETURNING cannot be determinstically sorted when using an INSERT which includes multi-row values().zINSERT zINTO  (%s)r   zTsentinel selection rules should have prevented us from getting here for this dialectr$  r<  r  r  r  r  r=  z DEFAULT VALUESr>  )rB  rC  rE  rF  rH  z VALUES c              3  X   #    U  H   nS SR                  S U 5       5      -  v   M"     g7f)rU  r   c              3  ,   #    U  H
  u    pov   M     g 7fr  r   )r-  r4  r  s      r   r/  5SQLCompiler.visit_insert.<locals>.<genexpr>.<genexpr>g  s      L^>1a^s   NrA  )r-  crud_param_sets     r   r/  +SQLCompiler.visit_insert.<locals>.<genexpr>e  s2       +N yy L^ LLN*Ms   (*c              3  0   #    U  H  u  pS U 3v   M     g7fpNr   )r-  r!  r4  s      r   r/  rv    s      ),IDA!A3,Is   c              3     >#    U  HL  u  ntp#TR                  UR                  UR                  R                  TR                  5      S U 35      v   MN     g7frx  )r,  r   r  r  )r-  r!  r  r4  r  s       r   r/  rv    sZ      4 1N9C !11 # # @ @ N"#A3 
 1Ns   AAz SELECT z FROM (VALUES (z)) AS imp_sen(z#, sen_counter) ORDER BY sen_counterz	 VALUES (r7  )r<  r=  r?  rA  rB  rC  rE  rF  rG  rH  rI  )?r  r#  r  rA  r  r  r  ro   rt  r   _get_crud_paramsr  rU  rb  single_paramsr  supports_default_valuesrA  supports_empty_insertr7   r  r   _has_multi_parametersrB  rG  
_returning_sort_by_parameter_orderr  r  r  format_tabler   r  r  r  r  rw   use_insertmanyvaluesuse_sentinel_columnsr[  r  rX  ra  _insert_sentinelr  r  rK  r   r  re  cte_follows_insertr  r;  default_metavalue_tokenr   _post_values_clauser\  all_multi_paramsrc  is_default_metavalue_onlyrd  r   r}  )$r  insert_stmtr  r  r  r  r"  counted_bindparamcrud_params_structcrud_params_singler  r}  r  r  r4  r4  r  named_sentinel_paramsadd_sentinel_colsrH  r  r  param_names_params_by_col_add_sentinel_col
param_namer  select_textr  r  r  embed_sentinel_valuerender_bind_castscolnamescolnames_w_castpost_values_clauses$   `                                   r   visit_insertSQLCompiler.visit_inserto  sr    $::
!#
 $--#!-~H::~H DM)))6&%%%2"

#&5 #)	
  ! ??|3
 !#!22	

 0
 
 ??0< #$5 6""))5**.??*->D*/== #LL88LL;;LL66""!\\../  ..<<;;&&137<<3D3DE  '';+A+A66&&I  "4!A!A!3!A!A=="&,,"F"F  D++2268 D 	**;+<+<=
 22;KMA((++K<%<Gdii+=>+=-!1a+=>  D  2FF9= !00JK4J4J 2 G G ,+++ 3E"2D.Q; $2D  " )+%):%(>04-!%!C!C)"J "8I)JJ04-)00< *; )0 GG6HHI -1) $5Q#7#H#H DH "&n!5=N8O!O#44$,  5   --...  $),,

234BFJLK yyT\\<<7?DJJT++&304 ,     ++#(?%%D#):LL889;M &#<< $77tC%62C-.&7#*&& 00		  +=*M*M  D )-		 +/9*++1eQ +)% $%GG6MMN
 0II ,0( GG6NNO &
  $yy ),56H,I)  H ) +/)) 4 1::L0M4 + +3"?"3 4$$=#> ?&&.Z 0//D ,1(i(A'B!DDD):$)'@'+9*( 3D#<< $77tC%62C-.(=&7)=)*&0 )$=#>a@@**6!%//"35" "000D$B$BC***D99T\\<<3;C

OM''"/,0 (  	  	

rs ?0"^s   %aa2a
c                    g)z3Provide a hook for MySQL to add LIMIT to the UPDATENr   )r  update_stmts     r   update_limit_clauseSQLCompiler.update_limit_clause      r   c                    g)z3Provide a hook for MySQL to add LIMIT to the DELETENr   )r  delete_stmts     r   delete_limit_clauseSQLCompiler.delete_limit_clause  r  r   c                6    SUS'   UR                   " U 4SS0UD6$ )zdProvide a hook to override the initial table clause
in an UPDATE statement.

MySQL overrides this.

Tr  r9  r  )r  r  
from_tableextra_fromsr  s        r   update_tables_clause SQLCompiler.update_tables_clause  s(     8,,TE$E"EEr   c                    [        S5      e)zfProvide a hook to override the generation of an
UPDATE..FROM clause.

MySQL and MSSQL override this.

zCThis backend does not support multiple-table criteria within UPDATEr  r  r  r  r  
from_hintsr  s         r   update_from_clauseSQLCompiler.update_from_clause  s     "%
 	
r   c                ^   UR                   " X40 UD6nUR                  nUb  X#S'   SnOU R                  (       + nU(       a5  SU l        U R                  (       d  X@l        U R
                  (       d  X@l        U R                  [        -  (       a5  [        0 [        5       5      nU R                  [        -  nU(       a  X`l        OS nSnUR                  n[        U5      n	U	(       aI  [        [        UR                  5      5      n
U Vs/ s H  oU
;  d  M
  UPM     nnU
R!                  U5      nO/ nUR                  1nU R                  R#                  UUUS.5        SnUR$                  (       a  XR&                  " XR$                  40 UD6-  nU R(                  " UUR                  U4SU0UD6n[*        R,                  " XXE40 UD6nUR.                  nUR0                  (       a  U R3                  X5      u  nnOS nUR4                  (       a  U R7                  X5        X-  nUS-  nUSR9                  S	 [;        S
U5       5       5      -  nU R<                  (       d  UR>                  (       aE  U R@                  (       a4  USU RC                  UU R<                  =(       d    UR>                  US9-   -  nU(       a1  U RD                  " UUR                  UU4SU0UD6nU(       a  USU-   -  nURF                  (       a.  U RH                  " URF                  4SU0UD6nU(       a  USU-   -  nU RK                  U5      nU(       a  USU-   -  nU R<                  (       d  UR>                  (       aE  U R@                  (       d4  USU RC                  UU R<                  =(       d    UR>                  US9-   -  nU RL                  (       a0  U(       d  [O        U R                  5      OS nU RQ                  US9U-   nU(       a  Uc   eURS                  SS9  U R                  RU                  S5        U$ s  snf )Nr  FTr  zUPDATE r<  z SET r   c              3  8   #    U  H  u  pp1US -   U-   v   M     g7f)=Nr   )r-  r4  r4  r  s       r   r/  +SQLCompiler.visit_update.<locals>.<genexpr>S  s)      
&! 3J&s   zList[Tuple[Any, str, str, Any]]r<  rq   WHERE r  UPDATEr  r  )+r  r#  r  rB  r  r  rz  rm  rq  ro   rn  r<  _extra_fromsr  r*   r   r   r  r  r  r  r   r{  r|  r  r  r  r  rw   r   rG  r  rK  r  r  r  rQ  r  re  r  r  r  r}  )r  r  r  r  r  r"  r<  r  r  is_multitable
main_fromsr  render_extra_fromsr  r  r  r  crud_paramsr  extra_from_textr  r  r  s                          r   visit_updateSQLCompiler.visit_update  s*   #::
!#
 $--#!-~H::~H DM)))6&%%%2"<<44$R/K<<,6L#. K L#00[)];+<+<=>J&"&a:*=;  " )..{;O!#*001O

#2 /)	
   ++2268 D ..
 $	

 

 "22}
:<
 )66(,(>(>)%M: !M((++K<		 
%)1;&
 
 	
 ""k&<&<--d33++E{/E/E(0 4    "55!!"	
 ( O o--&&11++9DHJA 	A%//<C,&&D ##{'='=00C$//''A;+A+A$, 0   D 993;C

OM***G$ND***x0

rS"s   	P*P*c                    [        S5      e)zProvide a hook to override the generation of an
DELETE..FROM clause.

This can be used to implement DELETE..USING for example.

MySQL and MSSQL override this.

zCThis backend does not support multiple-table criteria within DELETEr  r  s         r   delete_extra_from_clause$SQLCompiler.delete_extra_from_clause  s     "%
 	
r   c                .    UR                   " U 4SSS.UD6$ )NT)r  r9  r  )r  r  r  r  r  s        r   delete_table_clauseSQLCompiler.delete_table_clause  s*    ,,
d
.0
 	
r   c                   UR                   " X40 UD6nUR                  nUb  X#S'   SnOU R                  (       + nU(       a5  SU l        U R                  (       d  X@l        U R
                  (       d  X@l        U R                  [        -  (       a5  [        0 [        5       5      nU R                  [        -  nU(       a  X`l        OS nSnUR                  nUR                  1R                  U5      n	U R                  R                  U	U	US.5        Sn
UR                   (       a  XR"                  " XR                   40 UD6-  n
U
S-  n
 U R%                  UUR                  UUS9n[*        R,                  " XXE40 UD6  UR.                  (       a  U R1                  X5      u  pOS nUR2                  (       a  U R5                  X5        X-  n
U R6                  (       d  UR8                  (       aE  U R:                  (       a4  U
SU R=                  UU R6                  =(       d    UR8                  US	9-   -  n
U(       a1  U R>                  " UUR                  UU4S
U0UD6nU(       a  U
SU-   -  n
UR@                  (       a.  U RB                  " UR@                  4S
U0UD6nU(       a  U
SU-   -  n
U RE                  U5      nU(       a  U
SU-   -  n
U R6                  (       d  UR8                  (       aE  U R:                  (       d4  U
SU R=                  UU R6                  =(       d    UR8                  US	9-   -  n
U RF                  (       a0  U(       d  [I        U R                  5      OS nU RK                  US9U
-   n
U(       a  Uc   eURM                  SS9  U R                  RO                  S5        U
$ ! [&         aA    U R%                  XR                  U5      nU(       a  U R)                  UR                  US9n GNf = f)Nr  FTr  zDELETE FROM )r<  r<  rq  r<  r  r  DELETEr  r  )(r  r#  r  r@  r  r  rz  rm  rq  ro   rn  r<  r  r   r   r  r  r  r  	TypeErrorr  r   r{  r  r  r  r  rG  r  rK  r  r  r  rQ  r  re  r  r  r  r}  )r  r  r  r  r  r"  r<  r  r  r  r  r  r4  r  r  r  r  r  s                     r   visit_deleteSQLCompiler.visit_delete  s   #::
!#
 $--#!-~H::~H DM)))6&%%%2"<<44$R/K<<,6L#. K L#00&,,-33K@

#2 /)	
   ++2268 D 		M11!!'	 2 J 	dOBO(,(>(>)%M: !M((++K< ##{'='=,,C$//''A;+A+A$, 0   D ";;!!	
 ( O o--&&11++9DHJA 	A%//<C,&&D ##{'='=00C$//''A;+A+A$, 0   D 993;C

OM***G$ND***x0

rU  	M 11..J LL!2!2LL	Ms   N& &AO10O1c                >    SU R                   R                  U5      -  $ )NzSAVEPOINT %sr  format_savepointr  savepoint_stmtr  s      r   visit_savepointSQLCompiler.visit_savepoint&  s     > >~ NNNr   c                >    SU R                   R                  U5      -  $ )NzROLLBACK TO SAVEPOINT %sr  r  s      r   visit_rollback_to_savepoint'SQLCompiler.visit_rollback_to_savepoint)  s#    )DMM,J,J-
 
 	
r   c                >    SU R                   R                  U5      -  $ )NzRELEASE SAVEPOINT %sr  r  s      r   visit_release_savepoint#SQLCompiler.visit_release_savepoint.  s#    %(F(F)
 
 	
r   )-rR  ra  r\  rT  rU  rP  rS  rW  r[  rY  rV  r  rQ  r  rb  r  rJ  rI  rN  r  rx  rO  r  re  rf  rh  r  r`  ry  r<  r  rd  r@  rA  rH  rB  r  rg  rz  r  rt  r(  r  r  r  )r  r\   r#  r  r  r  rx  r'  ry  r  rz  rk  r  zOptional[SQLCompiler]r  r   )r
  rX  )r
  rF  )r
  zDict[Any, Any])r
  zMutableMapping[CTE, str])r
  zVMutableMapping[str, Union[_BindProcessorType[Any], Sequence[_BindProcessorType[Any]]]])NT)r  r  r  r  r
  r"  )NNTNTF)r  r  r  r  r  r  r  zOptional[int]r   r  rv  r  r
  r[   F)r$  r[   rw  r  r
  r"  )r
  zCallable[[Any], str])NFFNr   )NTr   N)r   ColumnClause[Any]r  Optional[_ResultMapAppender]r  r  r  r   r  z Optional[_AmbiguousTableNameMap]r  r   r
  r   r  )NF)r  zFunction[Any]r  r  r  r   r
  r   )FNNr   )NFNN)FFFFF)r  r   r   rD   r
  r   )r   r   r
  r   )FFNNNN)r   r   r  r  r  r  r  rX  r  zOptional[TypeEngine[Any]]r  zOptional[Set[str]]r  rZ  r  r   r
  r   )r  rM   r  r  r  r  r  zOptional[_FromHintsType]r  zOptional[CTE]r<  zOptional[FromLinter]r  zselectable._CTEOptsr  r   r
  rX  )FFFNFFNN)
r   r   r   r   r   r   r  r   r
  r  )NNNTFFT)FFNNNFN)r   r  r
  zTuple[str, _FromHintsType]
r  rB   r  zSequence[ColumnElement[Any]]r$  r  r  r   r
  r   )NFF)FFFNTNN)r   rJ   r
  rD  )r#  r   r$  rW   rI  z%List[_MutableCoreSingleExecuteParams]r6  rN  rJ  r@  rB  r  r  r  r
  z Iterator[_InsertManyValuesBatch]rs  )r   r   r   r   r   EXTRACT_MAPr  r&   r  r=  r   r  COMPOUND_KEYWORDSr  r@  rA  rB  rD  rE  rG  rH  rK  rL  rM  rQ  rR  rS  rT  rU  rV  rW  rY  r[  r\  r]  	frozensetr^  r_  r  r`  r  postfetch_lastrowidra  r(  rb  rc  rd  rn  rp  r?  r  patternr  r  r  rk  rl  r  r9  r  ro_memoized_propertyr  r  r  r  memoized_propertyr  memoized_instancemethodr  
contextlibcontextmanagerr  r  r  r  r  r  r  r  r  r  r  preload_modulerU  r[  rz  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r%  r+  r2  r6  rC  rQ  rX  rV  re  rn  rs  rx  r  r  r  r  r  r  r  r  r  r  r  r  ra  r  r  r  r  r  r  r  r  r	  r'  r<  r  rD  rG  rJ  rM  rP  r  r  r  r]  r`  ri  rn  rs  rx  r|  r  r  r  r  r  r  r  rf  rm  rr  rw  r  r  r  r  r  r  r,  r.   r;  r  r  r  r  r  r  r$   _CTEOptsr  r3  r6  r2  rG  r1  rP  r[  rc  rf  r  r  rq  ro  rB  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  r  r,   
CLIENTSIDErX  rb  SENTINEL_DEFAULTNONEr_  r`  r   r   r^  r  r&  rm  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r/  r/  	  s    K 			
  ; : /.66F)HdHdHd
 +*% .0O*/ .0O*/$ BF>E K((I--6 %$4 ',t+ 5:+T9
 "OT! B!! %('
 .-
 &+d* "OT! "d! ).- !ND  !&% =A "9@ +/-.
 6:295929=A:A<EK9G
 :C6D
 8<4F
   % 	    (,K$+ .2*1.2+2FD
,, 32 GFJJ'LM

#45**$$
%Q'<'D'D&EF # # C C )-/3 %%59PP +P &	P
 -P P P 3P Pd = =$ 
 0 ( (  M  MD G G 
  
!! ".  .9vGR 



 
8#  
 6:!
2
 
 
	
2 6:GK!'+ %~2~ E~ 	~
 %~ ~ ~ 
)~@ 
!!$ "$L 
3 
3  %C3C C 
	CJ 
34
 5
 43	  
	34P 5 Pd 
	34, 5 ,\>@OO .3-
` .3+` !#"/b

/ ;?".0EI9O!9O 89O 	9O
 ,9O #C9O 9O 
9OvA



4 052h
"@L&&K
(
T
:


7 ;?,, 8, 	,
 
,\8
C 04?B3- AC$L6"BB


4$
 ;?H*TM1d  6p8



 05*GG 
I IJAEBFAEBFAEBF

	
AE




 $" cJ$ $!%	DB#J&6	*$ #&*484815AA A 	A
 $A 2A  2A /A A 
AFC .2&*,0(2(;(;E(BII I 	I
 ,I $I *I &I I 
IV30 bH0?"$L9(

 
 !	

 
 

4 EI
8  "  %bJH$ .-#11-	/LM 

 ,1: '+* KZ
!!
!	#
!2h]~  %3j7 	
11 51
 "1 1 
1@ +0'X !%.`
<
)" (,'9'9,77,>>,==,>>,11,>>,55,55,55,55	
($& $D#I#I,11,::	
$ <<	(<|YY -Y C	Y
  CY Y "&Y ?Y 
*Yx
 AEpdF
KZ
 

AFO


r   r/  c                     ^  \ rS rSrSrS r\R                  " S5      U 4S j5       rS r	S r
S rS	 r          SS
 jrS rS rS rS rS rS rS rS rSrU =r$ )StrSQLCompileri4  a_  A :class:`.SQLCompiler` subclass which allows a small selection
of non-standard SQL features to render into a string value.

The :class:`.StrSQLCompiler` is invoked whenever a Core expression
element is directly stringified without calling upon the
:meth:`_expression.ClauseElement.compile` method.
It can render a limited set
of non-standard SQL constructs to assist in basic stringification,
however for more substantial custom or dialect-specific SQL constructs,
it will be necessary to make use of
:meth:`_expression.ClauseElement.compile`
directly.

.. seealso::

    :ref:`faq_sql_expression_string`

c                    g)Nz<name unknown>r   r  s     r   r  $StrSQLCompiler._fallback_column_nameH  s    r   zsqlalchemy.engine.urlc                X  > UR                   S:w  a  [        R                  R                  nUR                  R                  UR                   5      R                  5       " 5       nUR                  US U S9n[        U[        5      (       d  UR                  " U40 UD6$ [        TU ]1  X5      $ )Nr   )r  )stringify_dialectr&   rQ  
engine_urlURLr   get_dialectstatement_compilerr  r  r  r  r  )r  r  r  r  urlr  compilerr  s          r   r  ,StrSQLCompiler.visit_unsupported_compilationK  s    $$	1..++CggnnW%>%>?KKMOG114 2 H h77''6266w4WBBr   c                    U R                   " UR                  40 UD6< SU R                   " UR                  40 UD6< S3$ )Nr:  r;  )r  rx   r   r  s       r   visit_getitem_binary#StrSQLCompiler.visit_getitem_binaryY  s6    LL++LL,,
 	
r   c                (    U R                   " X40 UD6$ r  r  r  s       r   visit_json_getitem_op_binary+StrSQLCompiler.visit_json_getitem_op_binary_      ((@R@@r   c                (    U R                   " X40 UD6$ r  r  r  s       r   !visit_json_path_getitem_op_binary0StrSQLCompiler.visit_json_path_getitem_op_binaryb  r   r   c                @    SU R                   R                  U5       S3$ )Nz<next sequence value: >)r  format_sequencer  s      r   r  StrSQLCompiler.visit_sequencee  s#    $T]]%B%B8%L$MQO	
r   c          
         [         R                  " U5       Vs/ s H  nU R                  S USS0 5      PM     nnSSR                  U5      -   $ s  snf )NTFr  r   )r   r  ro  rw   )r  r  r  r$  r  r  rb  s          r   r  StrSQLCompiler.returning_clausej  s]     ++N;
; %%dAtUB?; 	 
 dii000	
s   Ac                R   ^ ^^ STS'   SSR                  UUU 4S jU 5       5      -   $ )NTr  r  r   c              3  N   >#    U  H  nUR                   " T4S T0TD6v   M     g7fr  Nr  r-  r  r  r  r  s     r   r/  4StrSQLCompiler.update_from_clause.<locals>.<genexpr>|  s-      #
    BBrB    "%rA  r  s   `   ``r   r  !StrSQLCompiler.update_from_clausex  s3     8 #
 #
 
 
 	
r   c                R   ^ ^^ STS'   SSR                  UUU 4S jU 5       5      -   $ )NTr  r   c              3  N   >#    U  H  nUR                   " T4S T0TD6v   M     g7fr  r  r  s     r   r/  :StrSQLCompiler.delete_extra_from_clause.<locals>.<genexpr>  s-       
    BBrB r  rA  r  s   `   ``r   r  'StrSQLCompiler.delete_extra_from_clause  s3     8dii  
  
 
 
 	
r   c                    g)NzSELECT 1 WHERE 1!=1r   r  s      r   r	  #StrSQLCompiler.visit_empty_set_expr  s    $r   c                    SU-  $ )Nz[%s]r   r  s      r   r  !StrSQLCompiler.get_from_hint_text  s    }r   c                *    U R                   " US40 UD6$ )Nz
 <regexp> r  r  s       r   r  +StrSQLCompiler.visit_regexp_match_op_binary  s    ,,V\HRHHr   c                *    U R                   " US40 UD6$ )Nz <not regexp> r  r  s       r   r  /StrSQLCompiler.visit_not_regexp_match_op_binary  s    ,,V5ELLLr   c                    SUR                   R                  " U 40 UD6< SUR                  R                  " U 40 UD6< S3$ )Nz<regexp replace>(r   r7  )rx   r  r   r  s       r   r  -StrSQLCompiler.visit_regexp_replace_op_binary  s:    KK**4626LL++D7B7
 	
r   c                    SUR                   R                  " U 40 UD6< SUR                  R                  " U 40 UD6< S3$ )Nz	TRY_CAST(r   r7  )rk  r  r  )r  r   r  s      r   visit_try_castStrSQLCompiler.visit_try_cast  s:    KK**4:6:OO..t>v>
 	
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!  r   r  r  s   @r   r  r  4  s    &  
01C 2C
AA

11 51
 "1 1 
1

%IM

 
r   r  c                     \ rS rSrSr\(       a     S2         S3S jjr\R                  S 5       r	\R                  S 5       r
   S4       S5S jjrS rS	 rS
 rS rS6S jr S7S jrS rS rS r S8S jrS rS6S jrS rS rS rS rS rS rS rS rS7S j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,S) r-S* r.S+ r/S, r0S- r1S. r2S/ r3S0 r4S1r5g)9DDLCompileri  Tc                    g r  r   r  s         r   r  DDLCompiler.__init__  s     r   c                `    U R                   R                  U R                   S U R                  S9$ )Nr)  )r  r  r  r3  s    r   r  DDLCompiler.sql_compiler  s/    ||..LL$T5N5N / 
 	
r   c                .    U R                   R                  $ r  )r  r  r3  s    r   type_compilerDDLCompiler.type_compiler  s    ||222r   Nc                    g r  r   r  s       r   r  DDLCompiler.construct_params  s     r   c                   UR                   n[        UR                  [        R                  5      (       a  UR                  5       nU R                  nUR                  UR                  5      n[        U5      S:X  a  US   SpvO	US   US   pvUR                  SU5        UR                  SU5        UR                  SUR                  UR                  5      5        U R                  R                  UR                  U-  5      $ )Nr   r   r  r  r   r#   r	  )contextr  targetr#   rJ   r  r  format_table_seqr  rX  r  r  r  r#  )r  ddlr  r/  r  pathr   schs           r   	visit_ddlDDLCompiler.visit_ddl  s    ++cjj&,,//llnG}}H,,SZZ8D4yA~!!Wbs!"XtAwsw.x-z8+@+@+LM  223==73JKKr   c                    SnUR                   (       a  US-  nX0R                  R                  UR                  5      -   $ )NzCREATE SCHEMA IF NOT EXISTS )if_not_existsr  format_schemar  )r  r   r  r  s       r   visit_create_schemaDDLCompiler.visit_create_schema  s7    $$Dmm11&..AAAr   c                    SnUR                   (       a  US-  nX0R                  R                  UR                  5      -  nUR                  (       a  US-  nU$ )NzDROP SCHEMA 
IF EXISTS  CASCADE)	if_existsr  r:  r  cascader  dropr  r  s       r   visit_drop_schemaDDLCompiler.visit_drop_schema  sI    >>L D++DLL99<<JDr   c                n   UR                   nU R                  nSnUR                  (       a!  USR                  UR                  5      S-   -  nUS-  nUR                  (       a  US-  nXTR                  U5      S-   -  nU R                  U5      nU(       a  XVS-   -  nUS-  nSnSnUR                   H]  n	U	R                   n
 U R                  XR                  =(       a    U(       + S9nUb  XW-  nS	nUS
U-   -  nU
R                  (       a  SnM]  M_     U R                  UUR                   S9nU(       a
  XWS
-   U-   -  nUSU R#                  U5      -  -  nU$ ! [        R                   aI  n[        R                  " SUR                  < SU
R                  < SUR                  S   < 35      UeS nAff = f)Nz
CREATE r<  zTABLE r8  r6  
Ffirst_pkr  	Tz(in table 'z', column 'z'): r   ) _include_foreign_key_constraintsz
)%s

)r  r  r  rw   r9  r  create_table_suffixrb  r  rr  r7   r  descriptionr   argscreate_table_constraintsinclude_foreign_key_constraintspost_create_table)r  r   r  r   r  r  rL  rB  rI  create_columnr   	processedceconsts                 r   visit_create_tableDDLCompiler.visit_create_table  s   ==??CHHU__-33D$$D%%e,s22"66u=#--D	 #^^M"**F LL!,>,>,Ox< ) 	 (%D &ID9,,D%%#H & ,$ ---3-S-S . 
 $u,,Dd44U;;; ## &&((&++rwwqzC s   AEF4+AF//F4c                   ^  UR                   nUR                  (       a  g T R                  XBS9nSR                  U 4S jUR                   5       5      nU(       a  USU-   -  nU$ )NrH  r<  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr  )r  r-  r   r  s     r   r/  2DDLCompiler.visit_create_column.<locals>.<genexpr>   s!      
7IDLL$$7Ir  )r  systemget_column_specificationrw   constraints)r  r   rI  r  r   r  rU  s   `      r   visit_create_columnDDLCompiler.visit_create_column  sb    ==,,V,G 
7=7I7I
 
 C%KDr   c                  ^  / nUR                   (       a  UR                  UR                   5        UR                  nUb  UR                  U5      nO
[	        5       nUR                  UR                   Vs/ s H  nXqR                   Ld  M  Xv;  d  M  UPM     sn5        SR                  S U 4S jU 5        5       5      $ s  snf )Nz, 
	c              3  0   #    U  H  nUc  M  Uv   M     g 7fr  r   )r-  ry  s     r   r/  7DDLCompiler.create_table_constraints.<locals>.<genexpr>?  s"      
  As   	c              3     >#    U  H]  nUR                  T5      (       d  M  TR                  R                  (       a  [        US S5      (       a  MJ  TR	                  U5      v   M_     g7f)	use_alterFN)_should_create_for_compilerr  supports_alterr  r  rZ  s     r   r/  rc  A  sT      "-J::4@ ) 33":{EB )Z(("-s   A(+A(A()rr  r  foreign_key_constraintsr  ro   r>  _sorted_constraintsrw   )r  r   rK  r  r^  all_fkcs	omit_fkcsr  s   `       r   rO  $DDLCompiler.create_table_constraints(  s    
 u00100+7 ++,LMII 222A--- 232D 2	
 }} 
"-
 
 	
s   4C 
C C c                    SnUR                   (       a  US-  nX0R                  R                  UR                  5      -   $ )Nz
DROP TABLE r>  )r@  r  r  r  rB  s       r   visit_drop_tableDDLCompiler.visit_drop_tableM  s4    >>L Dmm00>>>r   c                R    SU R                   R                  UR                  5      -   $ )Nz
DROP VIEW r  r  r  r  rC  r  s      r   visit_drop_viewDDLCompiler.visit_drop_viewS  s      : :4<< HHHr   c                d    UR                   c#  [        R                  " SUR                  -  5      eg )Nz,Index '%s' is not associated with any table.)r   r7   r  r   r  ru  s     r   _verify_index_tableDDLCompiler._verify_index_tableV  s0    ;;"">K  r   c           	       ^  UR                   nT R                  U5        T R                  nSnUR                  (       a  US-  nUR                  c  [
        R                  " S5      eUS-  nUR                  (       a  US-  nUT R                  XRS9< SUR                  UR                  US9< S	S
R                  U 4S jUR                   5       5      < S3-  nU$ )NzCREATE UNIQUE z0CREATE INDEX requires that the index have a namezINDEX r8  include_schemar  r
  r^  r   c              3  Z   >#    U  H   nTR                   R                  US SS9v   M"     g7f)FTr  r  N)r  r  )r-  r4  r  s     r   r/  1DDLCompiler.visit_create_index.<locals>.<genexpr>s  s9       .D !!))T *  .r  r7  )r  rw  r  r   r   r7   r  r9  _prepared_index_namer  r   rw   expressions)r  r   r|  include_table_schemar  ru  r  r  s   `       r   visit_create_indexDDLCompiler.visit_create_index\  s       '==<<ID::""B  	$$D%%e%K!!(< "  II  "--	 
 	
 r   c                    UR                   nUR                  c  [        R                  " S5      eSnUR                  (       a  US-  nX@R                  USS9-   $ )Nz.DROP INDEX requires that the index have a namez
DROP INDEX r>  Tr{  )r  r   r7   r  r@  r  )r  rC  r  ru  r  s        r   visit_drop_indexDDLCompiler.visit_drop_index|  s\    ::""@  >>L D//d/KKKr   c                   UR                   b&  U R                  R                  UR                   5      nOS nU(       a#  U(       a  U R                  R                  U5      nOS nU R                  R	                  U5      nU(       a  US-   U-   nU$ Nr9  )r   r  r  r  format_index)r  ru  r|  r  schema_name
index_names         r   r   DDLCompiler._prepared_index_name  sw    ;;"#}}>>u{{K#.--445EFKK]]//6
$s*Z7Jr   c                    SU R                   R                  UR                  R                  5      < SU R	                  UR                  5      < 3$ )NALTER TABLE z ADD )r  r  r  r   r  r  r   r  s      r   visit_add_constraint DDLCompiler.visit_add_constraint  s8    MM&&v~~';';<LL(
 	
r   c                    SU R                   R                  UR                  5      < SU R                  R	                  UR                  R
                  [        R                  " 5       5      < 3$ )NzCOMMENT ON TABLE r   )r  r  r  r  r  commentr%   Stringr  s      r   visit_set_table_comment#DDLCompiler.visit_set_table_comment  sL    MM&&v~~622&&(9
 	
r   c                R    SU R                   R                  UR                  5      -  $ )NzCOMMENT ON TABLE %s IS NULLrq  rr  s      r   visit_drop_table_comment$DDLCompiler.visit_drop_table_comment  s'    ,t}}/I/ILL0
 
 	
r   c                    SU R                   R                  UR                  SSS9< SU R                  R	                  UR                  R
                  [        R                  " 5       5      < 3$ )NzCOMMENT ON COLUMN T)	use_tabler
  r   )r  format_columnr  r  r  r  r%   r  r  s      r   visit_set_column_comment$DDLCompiler.visit_set_column_comment  sZ    MM''$4 (  22&&(9	
 	
r   c                P    SU R                   R                  UR                  SS9-  $ )NzCOMMENT ON COLUMN %s IS NULLT)r  )r  r  r  rr  s      r   visit_drop_column_comment%DDLCompiler.visit_drop_column_comment  s/    -0K0KLLD 1L 1
 
 	
r   c                B    [         R                  " U [        U5      5      er  r  r  s      r   visit_set_constraint_comment(DDLCompiler.visit_set_constraint_comment  s    --dDLAAr   c                B    [         R                  " U [        U5      5      er  r  rr  s      r   visit_drop_constraint_comment)DDLCompiler.visit_drop_constraint_comment  s    --dDJ??r   c                   / nUR                   b  UR                  SUR                   -  5        UR                  b  UR                  SUR                  -  5        UR                  b  UR                  SUR                  -  5        UR                  b  UR                  SUR                  -  5        UR
                  b  UR                  S5        UR                  b  UR                  S5        UR                  b  UR                  SUR                  -  5        UR                  b$  UR                  UR                  (       a  SOS	5        S
R                  U5      $ )NzINCREMENT BY %dzSTART WITH %dzMINVALUE %dzMAXVALUE %dzNO MINVALUEzNO MAXVALUEzCACHE %dCYCLEzNO CYCLEr<  )
	incrementr  r  minvaluemaxvalue
nominvalue
nomaxvaluecachecyclerw   )r  identity_optionsr  s      r   get_identity_options DDLCompiler.get_identity_options  s   %%1KK),<,F,FFG!!-KK*:*@*@@A$$0KK(8(A(AAB$$0KK(8(A(AAB&&2KK&&&2KK&!!-KK
%5%;%;;<!!-KK#3#9#9zJxx~r   c                    SnUR                   (       a  US-  nX@R                  R                  UR                  5      -  nU(       a  XB-  nU R	                  UR                  5      nU(       a  USU-   -  nU$ )NzCREATE SEQUENCE r8  r<  )r9  r  r  r  r  )r  r   r  r  r  optionss         r   visit_create_sequence!DDLCompiler.visit_create_sequence  sj    !$$D--fnn==ND++FNN;C'M!Dr   c                    SnUR                   (       a  US-  nX0R                  R                  UR                  5      -   $ )NzDROP SEQUENCE r>  )r@  r  r  r  rB  s       r   visit_drop_sequenceDDLCompiler.visit_drop_sequence  s4    >>L Dmm33DLLAAAr   c                   UR                   nUR                  b  U R                  R                  U5      nOS nUc#  [        R
                  " SUR                   -  5      eSU R                  R                  UR                   R                  5      < SUR                  (       a  SOS< U< UR                  (       a  S< 3$ S< 3$ )Nz<Can't emit DROP CONSTRAINT for constraint %r; it has no namer  z DROP CONSTRAINT r>  r  r?  )
r  r   r  format_constraintr7   r  r  r   r@  rA  )r  rC  r  r   formatted_names        r   visit_drop_constraint!DDLCompiler.visit_drop_constraint  s    \\
??&!]]<<ZHN!N!""!#'<<0  " MM&&t||'9'9: NNL2,,J.	
 	
 -/.	
 	
r   c                J   U R                   R                  U5      S-   U R                  R                  R	                  UR
                  US9-   nU R                  U5      nUb  USU-   -  nUR                  b!  USU R	                  UR                  5      -   -  nUR                  b<  U R                  R                  (       a!  USU R	                  UR                  5      -   -  nUR                  (       d1  UR                  (       a  U R                  R                  (       d  US-  nU$ )Nr<  )r  z	 DEFAULT z	 NOT NULL)r  r  r  r  r  r   get_column_default_stringcomputedidentitysupports_identity_columnsnullable)r  r   r  colspecr   s        r   r]  $DDLCompiler.get_column_specification  s    MM''/ll1199V :  	 008{W,,G??&sT\\&//:::G OO'66sT\\&//:::Gt||'M'M{"Gr   c                    gNr  r   r  r   s     r   rL  DDLCompiler.create_table_suffix      r   c                    gr  r   r  s     r   rQ  DDLCompiler.post_create_table  r  r   c                    [        UR                  [        R                  5      (       a%  U R	                  UR                  R
                  5      $ g r  )r  server_defaultr#   DefaultClauserender_default_stringargr  s     r   r  %DDLCompiler.get_column_default_string  s;    f++V-A-ABB--f.C.C.G.GHHr   c                    [        U[        5      (       a*  U R                  R                  U[        R
                  5      $ U R                  R                  USS9$ )NT)r  )r  r   r  r  r%   r\  r  )r  r   s     r   r  !DDLCompiler.render_default_string"  sQ    gs##$$99,,  $$,,WD,IIr   c                h    UR                   (       a  U R                  U5      $ U R                  U5      $ r  )is_column_levelvisit_column_check_constraintvisit_check_constraintr  r   r  s      r   &visit_table_or_column_check_constraint2DDLCompiler.visit_table_or_column_check_constraint*  s-    %%55jAA..z::r   c                    SnUR                   b&  U R                  R                  U5      nUb  USU-  -  nUSU R                  R	                  UR
                  SSS9-  -  nX0R                  U5      -  nU$ Nr  CONSTRAINT %s z
CHECK (%s)FTr  r   r  r  r  r  r  define_constraint_deferrabilityr  r   r  r  r  s        r   r  "DDLCompiler.visit_check_constraint0      ??&!]]<<ZHN)(>99t0088e4  9  
 
 	
 	44Z@@r   c                    SnUR                   b&  U R                  R                  U5      nUb  USU-  -  nUSU R                  R	                  UR
                  SSS9-  -  nX0R                  U5      -  nU$ r  r  r  s        r   r  )DDLCompiler.visit_column_check_constraint<  r  r   c                T  ^  [        U5      S:X  a  gSnUR                  b&  T R                  R                  U5      nUb  USU-  -  nUS-  nUSSR	                  U 4S jUR
                  (       a  UR                  OUR                   5       5      -  -  nUT R                  U5      -  nU$ )Nr   r  r  zPRIMARY KEY rU  r   c              3  n   >#    U  H*  nTR                   R                  UR                  5      v   M,     g 7fr  r  r  r   r-  r  r  s     r   r/  ;DDLCompiler.visit_primary_key_constraint.<locals>.<genexpr>Q  s5      #
(  MM''(r  )	r  r   r  r  rw   _implicit_generatedcolumns_autoinc_firstrb  r  r  s   `    r   visit_primary_key_constraint(DDLCompiler.visit_primary_key_constraintH  s    z?a??&!]]<<ZHN)(>99 #
 11 00''(#
 
 
 	
 	44Z@@r   c           
     $  ^ U R                   mSnUR                  b&  U R                   R                  U5      nUb  USU-  -  n[        UR                  5      S   R
                  R                  nUSSR                  U4S jUR                   5       5      < SU R                  XT5      < SSR                  U4S	 jUR                   5       5      < S
3-  nX0R                  U5      -  nX0R                  U5      -  nX0R                  U5      -  nU$ )Nr  r  r   zFOREIGN KEY(r   c              3  n   >#    U  H*  nTR                  UR                  R                  5      v   M,     g 7fr  )r  parentr   r-  r  r  s     r   r/  ;DDLCompiler.visit_foreign_key_constraint.<locals>.<genexpr>e  )      7J!qxx}}--7Jr  z) REFERENCES r^  c              3  n   >#    U  H*  nTR                  UR                  R                  5      v   M,     g 7fr  )r  r   r   r  s     r   r/  r  k  r  r  r7  )r  r   r  r  r   r   r   rw   define_constraint_remote_tabledefine_constraint_matchdefine_constraint_cascadesr  )r  r   r  r  r  remote_tabler  s         @r   visit_foreign_key_constraint(DDLCompiler.visit_foreign_key_constraint\  s
   ==??&!]]<<ZHN)(>99J//03::@@II 7A7J7J  //( II 7A7J7J 

 
	
 	,,Z88//
;;44Z@@r   c                $    UR                  U5      $ )z=Format the remote table clause of a CREATE CONSTRAINT clause.)r  )r  r   r   r  s       r   r  *DDLCompiler.define_constraint_remote_tablet  s     $$U++r   c                *  ^  [        U5      S:X  a  gSnUR                  b&  T R                  R                  U5      nUb  USU-  -  nUST R                  " U40 UD6< SSR                  U 4S jU 5       5      < S3-  nUT R                  U5      -  nU$ )	Nr   r  r  rz  r6  r   c              3  n   >#    U  H*  nTR                   R                  UR                  5      v   M,     g 7fr  r  r  s     r   r/  6DDLCompiler.visit_unique_constraint.<locals>.<genexpr>  s'     F:admm))!&&11:r  r7  )r  r   r  r  !define_unique_constraint_distinctrw   r  r  s   `    r   visit_unique_constraint#DDLCompiler.visit_unique_constrainty  s    z?a??&!]]<<ZHN)(>9922:DDIIF:FF
 	
 	44Z@@r   c                    gr  r   r  s      r   r	  -DDLCompiler.define_unique_constraint_distinct  r  r   c                    SnUR                   b0  USU R                  R                  UR                   [        5      -  -  nUR                  b0  USU R                  R                  UR                  [
        5      -  -  nU$ )Nr  z ON DELETE %sz ON UPDATE %s)ondeleter  validate_sql_phraseFK_ON_DELETEonupdateFK_ON_UPDATEr  r   r  s      r   r  &DDLCompiler.define_constraint_cascades  s    *Odmm&G&G##\'  D *Odmm&G&G##\'  D r   c                    SnUR                   b  UR                   (       a  US-  nOUS-  nUR                  b0  USU R                  R                  UR                  [        5      -  -  nU$ )Nr  z DEFERRABLEz NOT DEFERRABLEz INITIALLY %s)r   r   r  r	  FK_INITIALLYr	  s      r   r  +DDLCompiler.define_constraint_deferrability  sq      ,$$%))+Odmm&G&G$$l'  D r   c                H    SnUR                   b  USUR                   -  -  nU$ )Nr  z	 MATCH %s)rv  r	  s      r   r  #DDLCompiler.define_constraint_match  s-    'K*"2"222Dr   c                    SU R                   R                  UR                  SSS9-  nUR                  SL a  US-  nU$ UR                  SL a  US-  nU$ )NzGENERATED ALWAYS AS (%s)FTr  z STOREDz VIRTUAL)r  r  r  	persisted)r  	generatedr  r  s       r   visit_computed_column!DDLCompiler.visit_computed_column  sr    )D,=,=,E,EU$ -F -
 
 $&ID    E)JDr   c                z    SUR                   (       a  SOS< S3nU R                  U5      nU(       a  USU-  -  nU$ )Nz
GENERATED ALWAYSz
BY DEFAULTz AS IDENTITYrp  )alwaysr  )r  r  r  r  r  s        r   visit_identity_column!DDLCompiler.visit_identity_column  s@     H\9
 ++H5Gg%%Dr   r   )...)
r  r\   r#  r@   r  r  r  r  r  r  r  r  r  r  )FT)6r   r   r   r   r  r   r  r&   r  r  r*  r  r5  r;  rD  rV  r_  rO  rn  rs  rw  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r]  rL  rQ  r  r  r  r  r  r  r  r  r	  r	  r  r  r  r	  r	  r   r   r   r   r$  r$    s   F FI,/03		 ,	 #C		
 &*	 .	 

 

 
3 3
 6:GK!	2 E 	
 
3L&B2h  7;#
J?I BF@L 






B@(B
&6J;

(0,

r   r$  c                  2   \ 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S rS rS rS rS rS3S j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S 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,S, r-S- r.S. r/S/ r0S0 r1S1 r2S2r3g)4GenericTypeCompileri  c                    g)NFLOATr   r  s      r   visit_FLOATGenericTypeCompiler.visit_FLOAT      r   c                    g)NDOUBLEr   r  s      r   visit_DOUBLE GenericTypeCompiler.visit_DOUBLE      r   c                    g)NzDOUBLE PRECISIONr   r  s      r   visit_DOUBLE_PRECISION*GenericTypeCompiler.visit_DOUBLE_PRECISION  s    !r   c                    g)NREALr   r  s      r   
visit_REALGenericTypeCompiler.visit_REAL  r-  r   c                    UR                   c  gUR                  c  SSUR                   0-  $ SUR                   UR                  S.-  $ )NNUMERICzNUMERIC(%(precision)s)	precisionz!NUMERIC(%(precision)s, %(scale)s)r6	  scaler7	  r  s      r   visit_NUMERIC!GenericTypeCompiler.visit_NUMERIC  M    ??"[[ +{EOO.LLL6"__:  r   c                    UR                   c  gUR                  c  SSUR                   0-  $ SUR                   UR                  S.-  $ )NDECIMALzDECIMAL(%(precision)s)r6	  z!DECIMAL(%(precision)s, %(scale)s)r7	  r7	  r  s      r   visit_DECIMAL!GenericTypeCompiler.visit_DECIMAL  r;	  r   c                    g)NINTEGERr   r  s      r   visit_INTEGER!GenericTypeCompiler.visit_INTEGER      r   c                    g)NSMALLINTr   r  s      r   visit_SMALLINT"GenericTypeCompiler.visit_SMALLINT      r   c                    g)NBIGINTr   r  s      r   visit_BIGINT GenericTypeCompiler.visit_BIGINT  r,	  r   c                    g)N	TIMESTAMPr   r  s      r   visit_TIMESTAMP#GenericTypeCompiler.visit_TIMESTAMP  s    r   c                    g)NDATETIMEr   r  s      r   visit_DATETIME"GenericTypeCompiler.visit_DATETIME  rI	  r   c                    g)NDATEr   r  s      r   
visit_DATEGenericTypeCompiler.visit_DATE  r-  r   c                    g)NTIMEr   r  s      r   
visit_TIMEGenericTypeCompiler.visit_TIME  r-  r   c                    g)NCLOBr   r  s      r   
visit_CLOBGenericTypeCompiler.visit_CLOB  r-  r   c                    g)NNCLOBr   r  s      r   visit_NCLOBGenericTypeCompiler.visit_NCLOB  r'	  r   Nc                    UnU(       a	  USU-  -  nO#UR                   (       a  USUR                   -  -  nUR                  (       a  USUR                  -  -  nU$ )N(%d)z COLLATE "%s")lengthr  )r  r  r   length_overrider  s        r   _render_string_type'GenericTypeCompiler._render_string_type  sR    F_,,D\\FU\\))D??Oeoo55Dr   c                &    U R                  US5      $ )NCHARrj	  r  s      r   
visit_CHARGenericTypeCompiler.visit_CHAR      ''v66r   c                &    U R                  US5      $ )NNCHARrn	  r  s      r   visit_NCHARGenericTypeCompiler.visit_NCHAR	  s    ''w77r   c                &    U R                  US5      $ )NVARCHARrn	  r  s      r   visit_VARCHAR!GenericTypeCompiler.visit_VARCHAR  s    ''y99r   c                &    U R                  US5      $ )NNVARCHARrn	  r  s      r   visit_NVARCHAR"GenericTypeCompiler.visit_NVARCHAR  s    ''z::r   c                &    U R                  US5      $ )NTEXTrn	  r  s      r   
visit_TEXTGenericTypeCompiler.visit_TEXT  rq	  r   c                    g)NUUIDr   r  s      r   
visit_UUIDGenericTypeCompiler.visit_UUID  r-  r   c                    g)NBLOBr   r  s      r   
visit_BLOBGenericTypeCompiler.visit_BLOB  r-  r   c                ^    SUR                   =(       a    SUR                   -  =(       d    S-   $ )NBINARYrg	  r  rh	  r  s      r   visit_BINARY GenericTypeCompiler.visit_BINARY  s$    5<<AFU\\,AGRHHr   c                ^    SUR                   =(       a    SUR                   -  =(       d    S-   $ )N	VARBINARYrg	  r  r	  r  s      r   visit_VARBINARY#GenericTypeCompiler.visit_VARBINARY  s$    ellDv/DJKKr   c                    g)NBOOLEANr   r  s      r   visit_BOOLEAN!GenericTypeCompiler.visit_BOOLEAN!  rD	  r   c                    UR                   (       a  U R                  R                  (       d  U R                  USSS9$ U R                  " U40 UD6$ )Nrm	      )ri	  )native_uuidr  supports_native_uuidrj	  r	  r  s      r   
visit_uuidGenericTypeCompiler.visit_uuid$  sC      (I(I++E62+NN??5/B//r   c                (    U R                   " U40 UD6$ r  )r	  r  s      r   visit_large_binary&GenericTypeCompiler.visit_large_binary*      u+++r   c                (    U R                   " U40 UD6$ r  )r	  r  s      r   visit_boolean!GenericTypeCompiler.visit_boolean-      !!%.2..r   c                (    U R                   " U40 UD6$ r  )r\	  r  s      r   
visit_timeGenericTypeCompiler.visit_time0  r	  r   c                (    U R                   " U40 UD6$ r  )rT	  r  s      r   visit_datetime"GenericTypeCompiler.visit_datetime3      ""5/B//r   c                (    U R                   " U40 UD6$ r  )rX	  r  s      r   
visit_dateGenericTypeCompiler.visit_date6  r	  r   c                (    U R                   " U40 UD6$ r  )rL	  r  s      r   visit_big_integer%GenericTypeCompiler.visit_big_integer9        -"--r   c                (    U R                   " U40 UD6$ r  )rG	  r  s      r   visit_small_integer'GenericTypeCompiler.visit_small_integer<  r	  r   c                (    U R                   " U40 UD6$ r  )rB	  r  s      r   visit_integer!GenericTypeCompiler.visit_integer?  r	  r   c                (    U R                   " U40 UD6$ r  )r2	  r  s      r   
visit_realGenericTypeCompiler.visit_realB  r	  r   c                (    U R                   " U40 UD6$ r  )r%	  r  s      r   visit_floatGenericTypeCompiler.visit_floatE  s    ,,,r   c                (    U R                   " U40 UD6$ r  )r*	  r  s      r   visit_double GenericTypeCompiler.visit_doubleH  r	  r   c                (    U R                   " U40 UD6$ r  )r9	  r  s      r   visit_numeric!GenericTypeCompiler.visit_numericK  r	  r   c                (    U R                   " U40 UD6$ r  rx	  r  s      r   visit_string GenericTypeCompiler.visit_stringN  r	  r   c                (    U R                   " U40 UD6$ r  r	  r  s      r   visit_unicode!GenericTypeCompiler.visit_unicodeQ  r	  r   c                (    U R                   " U40 UD6$ r  r	  r  s      r   
visit_textGenericTypeCompiler.visit_textT  r	  r   c                (    U R                   " U40 UD6$ r  r	  r  s      r   visit_unicode_text&GenericTypeCompiler.visit_unicode_textW  r	  r   c                (    U R                   " U40 UD6$ r  r	  r  s      r   
visit_enumGenericTypeCompiler.visit_enumZ  r	  r   c                4    [         R                  " SU-  5      e)NzKCan't generate DDL for %r; did you forget to specify a type on this Column?r  r  s      r   r+  GenericTypeCompiler.visit_null]  s"    #%*+
 	
r   c                Z    U R                   " UR                  U R                  5      40 UD6$ r  )r  type_enginer  r  s      r   visit_type_decorator(GenericTypeCompiler.visit_type_decoratord  s%    ||E--dll;BrBBr   c                &    UR                   " S0 UD6$ r  )get_col_specr  s      r   visit_user_defined&GenericTypeCompiler.visit_user_definedg  s    !!'B''r   r   r  )4r   r   r   r   r%	  r*	  r.	  r2	  r9	  r>	  rB	  rG	  rL	  rP	  rT	  rX	  r\	  r`	  rd	  rj	  ro	  rt	  rx	  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	  r+  r	  r	  r   r   r   r   r"	  r"	    s    "		78:;7IL0,/,0,.0/,-.///,,/
C(r   r"	  c                  2    \ rS rSrS rS rS rS rS rSr	g)	StrSQLTypeCompilerik  c                t     UR                   nU" U 40 UD6$ ! [         a    U R                  " U40 UD6s $ f = fr  )r  AttributeError_visit_unknown)r  r  r  r  s       r   r  StrSQLTypeCompiler.processl  sL    	2!&!9!9 &d1b11  	4&&u333	4s    77c                \    UR                  S5      (       a  U R                  $ [        U5      e)Nr  )r}  r	  r	  )r  r.  s     r   __getattr__StrSQLTypeCompiler.__getattr__t  s(    >>(##&&& %%r   c                    UR                   R                  UR                   R                  R                  5       :X  a  UR                   R                  $ [        U5      $ r  )r  r   upperreprr  s      r   r	  !StrSQLTypeCompiler._visit_unknownz  sA    ??##u'?'?'E'E'GG??+++;r   c                    gr(  r   r  s      r   r+  StrSQLTypeCompiler.visit_null  r-  r   c                b     UR                   nU" S0 UD6$ ! [         a    [        U5      s $ f = fr  )r	  r	  r	  )r  r  r  r	  s       r   r	  %StrSQLTypeCompiler.visit_user_defined  s=    	& --L  %"%%  	;	s    ..r   N)
r   r   r   r   r  r	  r	  r+  r	  r   r   r   r   r	  r	  k  s    2&&r   r	  c                      \ rS rSrSS jrSrg)_SchemaForObjectCallablei  c                    g r  r   )r  _SchemaForObjectCallable__objs     r   r  !_SchemaForObjectCallable.__call__  s    3r   r   N)r	  r   r
  r   r  r   r   r   r	  r	    s    .r   r	  c                      \ rS rSrSS jrSrg)rW  i  c                    g r  r   )r  r  s     r   r   _BindNameForColProtocol.__call__  s    sr   r   N)r  r  r
  r   r  r   r   r   rW  rW    s    :r   rW  c                     \ rS rSr% Sr\r\r\	r
S\S'   S\S'   S\S'   \R                  " S5      rS	\S
'    SrS\S'        S-S jrS rS rS.S jrS.S jrS rS.S jrS/S jrS rS0S1S jjrS0S2S jjrS rS3S jr S0     S4S jjr S0     S5S jjrS0S jr\ RB                  " S5      S3S  j5       r"S3S! jr#S3S" jr$S# r%S$ r&S6S% jr'S& r( S0S' jr)     S7S( jr*S3S) jr+\ RX                  S* 5       r-S+ r.S,r/g)8r  i  z@Handle quoting and case-folding of identifiers based on options.r   initial_quotefinal_quotezMutableMapping[str, str]_stringsr#   r	  r  Fr  _includes_none_schema_translateNc                    Xl         X l        U=(       d    U R                  U l        X@l        U R                  S-  U l        X`l        XPl        0 U l        U R                   R                  S;   U l	        g)a+  Construct a new ``IdentifierPreparer`` object.

initial_quote
  Character that begins a delimited identifier.

final_quote
  Character that ends a delimited identifier. Defaults to
  `initial_quote`.

omit_schema
  Prevent prepending schema name. Useful for databases that do
  not support schemae.
r6   )r   r   N)
r  r	  r	  escape_quoteescape_to_quoteomit_schemaquote_case_sensitive_collationsr	  r|  r  )r  r  r	  r	  r	  r
  r
  s          r   r  IdentifierPreparer.__init__  sj    . *&<$*<*<(#0014&/N, $ 7 7 <
 !
r   c                   ^ U R                   R                  U R                   5      nUR                  R                  U R                  5        S U;   mU4S jnX2l        TUl        U$ )Nc                   > U R                   nU R                  (       aH  Uc  T(       a>  Ub%  SU;   d  SU;   a  [        R                  " SU-  5      e[	        SU=(       d    S-  SS9$ U R                   $ )Nr:  r;  zJSquare bracket characters ([]) not supported in schema translate name '%s'z__[SCHEMA_%s]_noneFr  )r#   _use_schema_mapr7   r  r0   )r  r   includes_nones     r   symbol_getter@IdentifierPreparer._with_schema_translate.<locals>.symbol_getter  sw    ::D""(8M#t**8:>?  ##tw7u  zz!r   )r  __new__r  r  r  r	  )r  r  prepr

  r	
  s       @r   r  )IdentifierPreparer._with_schema_translate  sV    ~~%%dnn5T]]+ 44	" "//<,r   c                   ^ ^ UmS T;   a/  T R                   (       d  [        R                  " S5      eTS    TS'   UU 4S jn[        R                  " SX15      $ )Nzschema translate map which previously did not have `None` present as a key now has `None` present; compiled statement may lack adequate placeholders.  Please use consistent keys in successive schema_translate_map dictionaries.r
  c                  > U R                  S5      nUT;   a  TU   nOUS;   a  [        R                  " S5      eUnU(       d3  TR                  R                  nU(       d  [        R
                  " S5      eTR                  U5      $ )Nr6   )Nr
  zschema translate map which previously had `None` present as a key now no longer has it present; don't know how to apply schema for compiled statement. Please use consistent keys in successive schema_translate_map dictionaries.zLDialect has no default schema name; can't use None as dynamic schema target.)r   r7   r1  r  default_schema_namer  r  )r  r   r  dr  s      r   r   =IdentifierPreparer._render_schema_translates.<locals>.replace  s    771:Dqy#$T7 ?*11=  $( ##'<<#C#C '**=  $$%566r   z(__\[SCHEMA_([^\]]+)\]))r	  r7   r1  rn  r  )r  r#  r  r   r
  s   `   @r   r  ,IdentifierPreparer._render_schema_translates  sX     1977--9  4AgJ	72 vv0'EEr   c                    UR                  U R                  U R                  5      nU R                  (       a  UR                  SS5      nU$ )zhEscape an identifier.

Subclasses should override this to provide database-dependent
escaping behavior.
r5  r  )r   r	  r 
  r  r  r  s     r   _escape_identifier%IdentifierPreparer._escape_identifier  s>     d//1E1EF  MM#t,Er   c                N    UR                  U R                  U R                  5      $ )zCanonicalize an escaped identifier.

Subclasses should override this to provide database-dependent
unescaping behavior that reverses _escape_identifier.
)r   r 
  r	  r
  s     r   _unescape_identifier'IdentifierPreparer._unescape_identifier!  s!     }}T1143D3DEEr   c                    Ub?  UR                  U5      (       d)  [        R                  " SU< SUR                  < S35      eU$ )zkeyword sequence filter.

a filter for elements that are intended to represent keyword sequences,
such as "INITIALLY", "INITIALLY DEFERRED", etc.   no special characters
should be present.

.. versionadded:: 1.3

zUnexpected SQL phrase: z (matching against r7  )rv  r7   r  r  )r  r  rq  s      r   r	  &IdentifierPreparer.validate_sql_phrase*  s@     syy'9'9""CKK)  r   c                X    U R                   U R                  U5      -   U R                  -   $ )zfQuote an identifier.

Subclasses should override this to provide database-dependent
quoting behavior.
)r	  r
  r	  r
  s     r   quote_identifier#IdentifierPreparer.quote_identifier<  s3     %%e,-	
r   c                    UR                  5       nX R                  ;   =(       dM    US   U R                  ;   =(       d4    U R                  R	                  [        U5      5      (       + =(       d    X!:g  $ )z5Return True if the given identifier requires quoting.r   )r  reserved_wordsillegal_initial_characterslegal_charactersrv  r   )r  r  lc_values      r   r  #IdentifierPreparer._requires_quotesI  sb    ;;=+++ #Qx4:::#((..s5z::# !		
r   c                T    U R                   R                  [        U5      5      (       + $ )zbReturn True if the given identifier requires quoting, but
not taking case convention into account.)r$
  rv  r   r
  s     r   r  1IdentifierPreparer._requires_quotes_illegal_charsS  s"     ((..s5z:::r   c                T    Ub  [         R                  " SSS9  U R                  U5      $ )a  Conditionally quote a schema name.


The name is quoted if it is a reserved word, contains quote-necessary
characters, or is an instance of :class:`.quoted_name` which includes
``quote`` set to ``True``.

Subclasses can override this to provide database-dependent
quoting behavior for schema names.

:param schema: string schema name
:param force: unused

    .. deprecated:: 0.9

        The :paramref:`.IdentifierPreparer.quote_schema.force`
        parameter is deprecated and will be removed in a future
        release.  This flag has no effect on the behavior of the
        :meth:`.IdentifierPreparer.quote` method; please refer to
        :class:`.quoted_name`.

zThe IdentifierPreparer.quote_schema.force parameter is deprecated and will be removed in a future release.  This flag has no effect on the behavior of the IdentifierPreparer.quote method; please refer to quoted_name().0.9r  )r&   r  r  )r  r#   forces      r   r  IdentifierPreparer.quote_schemaX  s5    .    !  zz&!!r   c                f   Ub  [         R                  " SSS9  [        USS5      nUcp  XR                  ;   a  U R                  U   $ U R	                  U5      (       a  U R                  U5      U R                  U'   OXR                  U'   U R                  U   $ U(       a  U R                  U5      $ U$ )a  Conditionally quote an identifier.

The identifier is quoted if it is a reserved word, contains
quote-necessary characters, or is an instance of
:class:`.quoted_name` which includes ``quote`` set to ``True``.

Subclasses can override this to provide database-dependent
quoting behavior for identifier names.

:param ident: string identifier
:param force: unused

    .. deprecated:: 0.9

        The :paramref:`.IdentifierPreparer.quote.force`
        parameter is deprecated and will be removed in a future
        release.  This flag has no effect on the behavior of the
        :meth:`.IdentifierPreparer.quote` method; please refer to
        :class:`.quoted_name`.

NzThe IdentifierPreparer.quote.force parameter is deprecated and will be removed in a future release.  This flag has no effect on the behavior of the IdentifierPreparer.quote method; please refer to quoted_name().r*
  r  r  )r&   r  r  r	  r  r
  )r  r  r+
  s      r   r  IdentifierPreparer.quote  s    ,    !  w-=%}}U++((//+/+@+@+GDMM%(+0MM%(}}U++((//Lr   c                J    U R                   (       a  U R                  U5      $ U$ r  )r
  r  )r  collation_names     r   r  #IdentifierPreparer.format_collation  s     //::n--!!r   c                    U R                  UR                  5      nU R                  U5      nU R                  (       d!  U(       a  Ub  U R	                  U5      S-   U-   nU$ r  )r  r   r  r
  r  )r  r  r
  r   r  s        r   r  "IdentifierPreparer.format_sequence  sY    zz(--(11(;    ,$$%56<tCDr   c                J    U R                  U=(       d    UR                  5      $ r  r  r   )r  r  r   s      r   r  IdentifierPreparer.format_label  s     zz$,%**--r   c                j    Uc   Uc   eU R                  UR                  5      $ U R                  U5      $ r  r5
  )r  r  r   s      r   r  IdentifierPreparer.format_alias  s7     <$$$::ejj))::d##r   c                ~    U=(       d    UR                   nU R                  U5      (       a  U R                  U5      nU$ r  )r  r  r
  )r  	savepointr   r  s       r   r  #IdentifierPreparer.format_savepoint  s8     '	  ''))%0Er   zsqlalchemy.sql.namingc                   [         R                  R                  nUR                  [        L a   UR                  XR                  5      nUc  g OUR                  nUR                  S:X  a  U R                  XBS9$ U R                  XBS9$ )Nru  )_alembic_quote)
r&   rQ  
sql_namingr   r+   _constraint_name_for_tabler   r  truncate_and_render_index_name#truncate_and_render_constraint_name)r  r   r=
  namingr   s        r   r  $IdentifierPreparer.format_constraint  s    **??j(44,,D |  ??D$$/66 7   ;; <  r   c                    U R                   R                  =(       d    U R                   R                  nU R                  XU5      $ r  )r  max_index_name_lengthr   _truncate_and_render_maxlen_namer  r   r=
  max_s       r   r@
  1IdentifierPreparer.truncate_and_render_index_name  sB    
 LL.. 2||11 	 44
 	
r   c                    U R                   R                  =(       d    U R                   R                  nU R                  XU5      $ r  )r  max_constraint_name_lengthr  rF
  rG
  s       r   rA
  6IdentifierPreparer.truncate_and_render_constraint_name   sB    
 LL33 2||11 	 44
 	
r   c                   [        U[        R                  5      (       a5  [        U5      U:  a%  USUS-
   S-   [        R
                  " U5      SS  -   nOU R                  R                  U5        U(       d  U$ U R                  U5      $ )Nr   rZ  r4  )	r  r   rD   r  r&   md5_hexr  validate_identifierr  )r  r   rH
  r=
  s       r   rF
  3IdentifierPreparer._truncate_and_render_maxlen_name  su    dH55664y4Aq)C/$,,t2DRS2IILL,,T2K::d##r   c                $    U R                  U5      $ r  )r  rv  s     r   r  IdentifierPreparer.format_index  s    %%e,,r   c                    Uc  UR                   nU R                  U5      nU R                  U5      nU R                  (       d%  U(       a  U(       a  U R	                  U5      S-   U-   nU$ )z'Prepare a quoted table and schema name.r9  )r   r  r  r
  r  )r  r   r
  r   rx  r  s         r   r  IdentifierPreparer.format_table  s_     <::DD!11%8J3C&&'783>GFr   c                $    U R                  U5      $ )zPrepare a quoted schema name.r
  r  s     r   r:   IdentifierPreparer.format_schema)  s     zz$r   c                    Ub0  [        U[        R                  5      (       a  UR                  U5      nU R	                  U5      $ )Prepare a quoted column name.)r  r   rD   r  r  )r  r   r  s      r   r  $IdentifierPreparer.format_label_name.  s@     J(++%
 %
 >>(+Dzz$r   c                   Uc  UR                   nUb0  [        U[        R                  5      (       a  UR	                  U5      n[        USS5      (       dG  U(       a/  U R                  UR                  XTS9S-   U R                  U5      -   $ U R                  U5      $ U(       a   U R                  UR                  XTS9S-   U-   $ U$ )rY
  r  F)r
  r   r9  )	r   r  r   rD   r  r  r  r   r  )r  r   r  r   
table_namer
  r  s          r   r   IdentifierPreparer.format_column<  s     <;;DJ(++%
 %
 >>(+Dv|U33%% &   jj&	' zz$''
 %% &   	 r   c                    U R                  U5      nU R                  (       d/  U(       a(  U(       a!  U R                  U5      U R                  USS94$ U R                  USS94$ )z(Format table name and schema as a tuple.Fr}  )r  r
  r  r  )r  r   r
  r  s       r   r1  #IdentifierPreparer.format_table_seqi  sj      11%8J3C!!"23!!%E!: 
 %%e%>@@r   c                    S U R                   U R                  U R                  U R                  5      4 5       u  pn[        R                  " SXUS.-  5      nU$ )Nc              3  N   #    U  H  n[         R                  " U5      v   M     g 7fr  )rn  ro  r:  s     r   r/  4IdentifierPreparer._r_identifiers.<locals>.<genexpr>|  s%      )
 IIaLLs   #%zM(?:(?:%(initial)s((?:%(escaped)s|[^%(final)s])+)%(final)s|([^\.]+))(?=\.|$))+)initialfinalrc  )r	  r	  r
  rn  rp  )r  rc
  rd
  escaped_finalrs        r   _r_identifiers!IdentifierPreparer._r_identifiersz  sl    )
 ""  ''(8(89)
% JJ$ "mLM
 r   c                    U R                   nUR                  U5       VVs/ s H  u  p4U=(       d    UPM     snn Vs/ s H  nU R                  U5      PM     sn$ s  snnf s  snf )z:Unpack 'schema.table.column'-like strings into components.)rg
  findallr
  )r  identifiersrf
  ar  r!  s         r   unformat_identifiers'IdentifierPreparer.unformat_identifiers  sf      *+;)?@)?af1f)?@
@ %%a(@
 	
@
s
   AA")	r  r	  r  r	  r 
  r	  r	  r
  r
  )r  Nr  TF)r  r   r
  r   )r  r   r
  r  r  )r#   r   r+
  r   r
  r   )r  r   r+
  r   r
  r   )T)r  z
Label[Any]r   rX  r
  r   )r  zOptional[AliasedReturnsRows]r   rX  r
  r   )TN)FNNFN)0r   r   r   r   r   RESERVED_WORDSr"
  LEGAL_CHARACTERSr$
  ILLEGAL_INITIAL_CHARACTERSr#
  r   rs  
attrgetterr  r	  r  r  r  r
  r
  r	  r
  r  r  r  r  r  r  r  r  r  r&   r  r  r@
  rA
  rF
  r  r  r:  r  r  r1  r  rg
  rm
  r   r   r   r   r  r    sx   J#N'!;&&2:2E2Eh2O/O -2#T1
 (,"
H0'FR
F$

;
%"N2h" 8<..'4.	. JN$1$9F$	$ 
01 2,




$-   " +ZA" 
 "
r   r  )r   
__future__r   r~  collections.abcabcr  r  enumr   rC  r  rs  rn  timer   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   r   r   r    r!   r"   r#   r$   r%   r&   r  _typingr'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   type_apir3   visitorsr4   r5   r7   r8   util.typingr9   r:   r;   
annotationr<   r=   r>   r  r?   r2  r@   dmlrA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   engine.cursorrT   engine.interfacesrU   rV   rW   rX   rY   rZ   r[   r\   r]   r   _FromHintsTypero
  rp  Irp
  LEGAL_CHARACTERS_PLUS_SPACErG  r   rq
  r	  r	  r	  UNICODEr  r  r~  r  rK  or_r  mulr  modnegltlenegtgeeqis_distinct_fromis_not_distinct_from	concat_opr  not_match_opr  r  r  r  r  r  r  r   existsdistinct_opinvany_opall_opdesc_opasc_opnulls_first_opnulls_last_opbitwise_xor_opbitwise_or_opbitwise_and_opbitwise_not_opbitwise_lshift_opbitwise_rshift_opr  r   r   r   r   r   r   r   r   r   r   r   cuberollupgrouping_setsr   r   r  _CompoundSelectKeywordr   	UNION_ALLr   
EXCEPT_ALLr   INTERSECT_ALLr  r   r  r  r  r  r  r  r  r"  r;  rK  rX  rf  rk  r2  rl  rm  rn  ro  
namedtuplerq  r  EnsureKWArgr  BinaryElementRoleCompilerColumnElementr  r  r/  r  r$  r"	  r	  r	  rW  r  )rl  s   0r   <module>r
     s  " #  )      	             !                       &     2   # !     %     ! " #	+,"#)*'&'#./&+'"',4<:<=3=C+:lC'(_B ::.5  jj):BDDA .3Arl;lc!fl;AA3%H zz<bdd zz<bdd zz5rtt<jjA2::N**92::F$ "$.NNG. MM6. MM5	.
 MM5. MM5. MM5. MM3. LL%. LL&. LL&. LL%. LL&. LL%.  4.  ""$<!." #.$ 	%.& M'.( OOV).* +., -.. OOX/.0 MM61.2 MM63.4 j5.6 {7.: i;.< ;=.> MM6?.@ fA.B fC.F wG.H fI.J nK.L ]eUec[.	b 
NN!4N.hyNNNFNNFh_-	) & ""$(& %%++W%%//%%,,h%%00,%%//%%33_  >   ! *   
J  i $1 $:J :zt
 tnZ 2!; !$G  g . FKF B
&l
?#''w6HI ?#DH' H'VF4## F0	C ("@"@2#
	C ("@"@#
LhT
( hT
Vil
[ l
^X( Xvj(, j(Z&, &B/x /;h ;
 
]] <s   #a;