Ë
    r™ãjŸ2  ã                  óÞ  — d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ ddlm	Z	 d	d
l
mZ d	dl
mZ d	dl
mZ d	dl
mZ d	dl
mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" ddl m#Z# ddl m$Z$ ddl%m&Z& dd l'm(Z( dd!l)m*Z* dd"l+m,Z, d#Z-d.d%„Z. G d&„ d$e«      Z G d'„ d(ee!«      Z/ G d)„ d*e/«      Z0 G d+„ d,e/«      Z1y-)/é    )Úannotations)ÚAny)ÚDict)ÚList)ÚOptional)ÚUnioné   )Úexté   )Ú_OnConflictConstraintT)Ú_OnConflictIndexElementsT)Ú_OnConflictIndexWhereT)Ú_OnConflictSetT)Ú_OnConflictWhereTé   )Úutil)Ú	coercions)Úroles)Úschema)Ú_DMLTableArgument)Ú_exclusive_against)ÚColumnCollection)ÚReadOnlyColumnCollection)ÚSyntaxExtension)Ú_DMLColumnElement©ÚInsert)ÚClauseElement)ÚColumnElement)ÚKeyedColumnElement)Ú
TextClause)Úalias)ÚNULLTYPE)ÚInternalTraversal)ÚSelf)r   Úinsertr   c                ó   — t        | «      S )as  Construct a PostgreSQL-specific variant :class:`_postgresql.Insert`
    construct.

    .. container:: inherited_member

        The :func:`sqlalchemy.dialects.postgresql.insert` function creates
        a :class:`sqlalchemy.dialects.postgresql.Insert`.  This class is based
        on the dialect-agnostic :class:`_sql.Insert` construct which may
        be constructed using the :func:`_sql.insert` function in
        SQLAlchemy Core.

    The :class:`_postgresql.Insert` construct includes additional methods
    :meth:`_postgresql.Insert.on_conflict_do_update`,
    :meth:`_postgresql.Insert.on_conflict_do_nothing`.

    r   )Útables    úm/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/sqlalchemy/dialects/postgresql/dml.pyr&   r&   ,   s   € ô" �%‹=Ðó    c                  ó¶   — e Zd ZdZdZdZej                  	 	 dd„«       Z e	dddi¬«      Z
e
	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd	„«       Ze
	 	 	 d	 	 	 	 	 	 	 dd
„«       Zy)r   zðPostgreSQL-specific implementation of INSERT.

    Adds methods for PG-specific syntaxes such as ON CONFLICT.

    The :class:`_postgresql.Insert` object is created using the
    :func:`sqlalchemy.dialects.postgresql.insert` function.

    Ú
postgresqlTc                óD   — t        | j                  d¬«      j                  S )ak  Provide the ``excluded`` namespace for an ON CONFLICT statement

        PG's ON CONFLICT clause allows reference to the row that would
        be inserted, known as ``excluded``.  This attribute provides
        all columns in this row to be referenceable.

        .. tip::  The :attr:`_postgresql.Insert.excluded` attribute is an
            instance of :class:`_expression.ColumnCollection`, which provides
            an interface the same as that of the :attr:`_schema.Table.c`
            collection described at :ref:`metadata_tables_and_columns`.
            With this collection, ordinary names are accessible like attributes
            (e.g. ``stmt.excluded.some_column``), but special names and
            dictionary method names should be accessed using indexed access,
            such as ``stmt.excluded["column name"]`` or
            ``stmt.excluded["values"]``.   See the docstring for
            :class:`_expression.ColumnCollection` for further examples.

        .. seealso::

            :ref:`postgresql_insert_on_conflict` - example of how
            to use :attr:`_expression.Insert.excluded`

        Úexcluded)Úname)r"   r(   Úcolumns)Úselfs    r)   r.   zInsert.excludedM   s   € ô6 �T—Z‘Z jÔ1×9Ñ9Ð9r*   Ú_post_values_clausezCThis Insert construct already has an ON CONFLICT clause established)ÚmsgsNc           	     ó>   — | j                  t        |||||«      «      S )a$  
        Specifies a DO UPDATE SET action for ON CONFLICT clause.

        Either the ``constraint`` or ``index_elements`` argument is
        required, but only one of these can be specified.

        :param constraint:
         The name of a unique or exclusion constraint on the table,
         or the constraint object itself if it has a .name attribute.

        :param index_elements:
         A sequence consisting of string column names, :class:`_schema.Column`
         objects, or other column expression objects that will be used
         to infer a target index.

        :param index_where:
         Additional WHERE criterion that can be used to infer a
         conditional target index.

        :param set\_:
         A dictionary or other mapping object
         where the keys are either names of columns in the target table,
         or :class:`_schema.Column` objects or other ORM-mapped columns
         matching that of the target table, and expressions or literals
         as values, specifying the ``SET`` actions to take.

         .. versionadded:: 1.4 The
            :paramref:`_postgresql.Insert.on_conflict_do_update.set_`
            parameter supports :class:`_schema.Column` objects from the target
            :class:`_schema.Table` as keys.

         .. warning:: This dictionary does **not** take into account
            Python-specified default UPDATE values or generation functions,
            e.g. those specified using :paramref:`_schema.Column.onupdate`.
            These values will not be exercised for an ON CONFLICT style of
            UPDATE, unless they are manually specified in the
            :paramref:`.Insert.on_conflict_do_update.set_` dictionary.

        :param where:
         Optional argument. An expression object representing a ``WHERE``
         clause that restricts the rows affected by ``DO UPDATE SET``. Rows not
         meeting the ``WHERE`` condition will not be updated (effectively a
         ``DO NOTHING`` for those rows).


        .. seealso::

            :ref:`postgresql_insert_on_conflict`

        )r
   ÚOnConflictDoUpdate)r1   Ú
constraintÚindex_elementsÚindex_whereÚset_Úwheres         r)   Úon_conflict_do_updatezInsert.on_conflict_do_updater   s)   € ðv �x‰xÜØ˜N¨K¸¸uóó
ð 	
r*   c                ó:   — | j                  t        |||«      «      S )a	  
        Specifies a DO NOTHING action for ON CONFLICT clause.

        The ``constraint`` and ``index_elements`` arguments
        are optional, but only one of these can be specified.

        :param constraint:
         The name of a unique or exclusion constraint on the table,
         or the constraint object itself if it has a .name attribute.

        :param index_elements:
         A sequence consisting of string column names, :class:`_schema.Column`
         objects, or other column expression objects that will be used
         to infer a target index.

        :param index_where:
         Additional WHERE criterion that can be used to infer a
         conditional target index.

        .. seealso::

            :ref:`postgresql_insert_on_conflict`

        )r
   ÚOnConflictDoNothing)r1   r6   r7   r8   s       r)   Úon_conflict_do_nothingzInsert.on_conflict_do_nothing³   s!   € ð> �x‰xÜ 
¨N¸KÓHó
ð 	
r*   )Úreturnz6ReadOnlyColumnCollection[str, KeyedColumnElement[Any]]©NNNNN)r6   r   r7   r   r8   r   r9   r   r:   r   r?   r%   ©NNN)r6   r   r7   r   r8   r   r?   r%   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústringify_dialectÚinherit_cacher   Úmemoized_propertyr.   r   Ú_on_conflict_exclusiver;   r>   © r*   r)   r   r   @   sö   „ ñð %ÐØ€Mà	×Ñð:à	?ò:ó ð:ñ8 0Øà!ð $0ð
ôÐð ð .2Ø48Ø.2Ø $Ø#'ð>
à*ð>
ð 2ð>
ð ,ð	>
ð
 ð>
ð !ð>
ð 
ò>
ó ð>
ð@ ð .2Ø48Ø.2ð	 
à*ð 
ð 2ð 
ð ,ð	 
ð
 
ò 
ó ñ 
r*   c                  ó¤   — e Zd ZU dZded<   ded<   ded<   dej                  fdej                  fdej                  fgZ		 	 	 d	 	 	 	 	 dd	„Z
dd
„Zy)ÚOnConflictClauser,   zOptional[str]Úconstraint_targetz.Optional[List[Union[str, schema.Column[Any]]]]Úinferred_target_elementsz/Optional[Union[ColumnElement[Any], TextClause]]Úinferred_target_whereclauseNc                óÀ  — |�Jt        |t        «      s:t        |t        j                  t        j
                  f«      rt        |d«      xs |}|�Õ|�t        d«      ‚t        |t        «      r|| _        d | _	        d | _
        n¢t        |t        j                  «      r+|j                  }|j                  d   j                  d«      }n]t        |t        j
                  «      r|j                  }|j                   }n*|j                  }|j                  d   j                  d«      }|�œd | _        |D �cg c]&  }t#        j$                  t&        j(                  |«      ‘Œ( c}| _	        |�Tt#        j$                  t        |t        j
                  «      rt&        j*                  nt&        j,                  |«      | _
        y d | _
        y |€d x| _        x| _	        | _
        y y c c}w )Nr/   z8'constraint' and 'index_elements' are mutually exclusiver,   r:   )Ú
isinstanceÚstrr   Ú
Constraintr
   ÚExcludeConstraintÚgetattrÚ
ValueErrorrM   rN   rO   ÚIndexÚexpressionsÚdialect_optionsÚgetr0   r:   r   Úexpectr   ÚDDLConstraintColumnRoleÚStatementOptionRoleÚWhereHavingRole)r1   r6   r7   r8   Úcolumns        r)   Ú__init__zOnConflictClause.__init__æ   sÔ  € ð Ð!Ü˜j¬#Ô.´:ØÜ×"Ñ"¤C×$9Ñ$9Ð:ô4ô % Z°Ó8ÒF¸J�
àÐ!ØÐ)Ü ØNóð ô ˜*¤cÔ*Ø)3�Ô&Ø04�Ô-Ø37�Õ0Ü˜J¬¯©Ô5Ø!+×!7Ñ!7�Ø(×8Ñ8¸ÑF×JÑJØó‘ô ˜J¬×(=Ñ(=Ô>Ø!+×!3Ñ!3�Ø(×.Ñ.‘à!+×!3Ñ!3�Ø(×8Ñ8¸ÑF×JÑJØó�ð Ð%Ø%)ˆDÔ"ð -ö-àô × Ñ ¤×!>Ñ!>ÀÕGò-ˆDÔ)ð Ð*ô × Ñ ô & j´#×2GÑ2GÔHô ×1Ò1ä"×2Ñ2àóð Õ,ð ð Õ,ð Ðð ðˆDÔ"ð  TÔ%BØÕ0ð  ùò%-s   Ä1+Gc                ó<   — |j                  | j                  d«       y )NÚpost_values)Úapply_syntax_extension_pointÚappend_replacing_same_type)r1   Úinsert_stmts     r)   Úapply_to_insertz OnConflictClause.apply_to_insert$  s   € Ø×0Ñ0Ø×+Ñ+¨]õ	
r*   rA   )r6   r   r7   r   r8   r   )re   ÚStandardInsertr?   ÚNone)rB   rC   rD   rF   Ú__annotations__r$   Ú	dp_stringÚdp_multi_listÚdp_clauseelementÚ_traverse_internalsr`   rf   rJ   r*   r)   rL   rL   ×   s‡   … Ø$Ðà$Ó$ØLÓLð"ó ð
 
Ð/×9Ñ9Ð:Ø	#Ð%6×%DÑ%DÐEØ	&Ð(9×(JÑ(JÐKðÐð .2Ø48Ø.2ð	<à*ð<ð 2ð<ð ,ó	<ô|
r*   rL   c                  ó   — e Zd ZdZdZy)r=   r>   TN)rB   rC   rD   Ú__visit_name__rG   rJ   r*   r)   r=   r=   *  s   „ Ø-€Nà�Mr*   r=   c                  óª   ‡ — e Zd ZU dZded<   ded<   ej                  dej                  fdej                  fgz   Z	 	 	 	 	 d	 	 	 	 	 	 	 	 	 dˆ fd„Z
ˆ xZS )	r5   r;   z+Dict[_DMLColumnElement, ColumnElement[Any]]Úupdate_values_to_setzOptional[ColumnElement[Any]]Úupdate_whereclausec                óR  •— t         ‰| �  |||¬«       | j                  €| j                  €t	        d«      ‚t        |t        «      r|s2t	        d«      ‚t        |t        «      rt        |«      }nt	        d«      ‚|j                  «       D ��ci c]S  \  }}t        j                  t        j                  |«      t        j                  t        j                  |t        d¬«      “ŒU c}}| _        |�*t        j                  t        j                   |«      | _        y d | _        y c c}}w )N)r6   r7   r8   zVEither constraint or index_elements, but not both, must be specified unless DO NOTHINGz*set parameter dictionary must not be emptyzqset parameter must be a non-empty dictionary or a ColumnCollection such as the `.c.` collection of a Table objectT)Útype_Úis_crud)Úsuperr`   rN   rM   rV   rQ   Údictr   Úitemsr   r[   r   ÚDMLColumnRoleÚExpressionElementRoler#   rq   r^   rr   )	r1   r6   r7   r8   r9   r:   ÚkÚvÚ	__class__s	           €r)   r`   zOnConflictDoUpdate.__init__;  s%  ø€ ô 	‰ÑØ!Ø)Ø#ð 	ô 	
ð ×)Ñ)Ð1Ø×&Ñ&Ð.äðDóð ô
 �dœDÔ!ÙÜ Ð!MÓNÐNÜ˜Ô.Ô/Ü˜“:‰Däð$óð ð Ÿ
™
›÷	%
ñ ��1ô ×ÑœU×0Ñ0°!Ó4´i×6FÑ6FÜ×+Ñ+¨Q´hÈô7ñ ó%
ˆÔ!ð Ð ô ×ÑœU×2Ñ2°EÓ:ð 	Õð ð 	Õùó%
s   ÂAD#r@   )
r6   r   r7   r   r8   r   r9   r   r:   r   )rB   rC   rD   ro   ri   rL   rm   r$   Údp_dml_valuesrl   r`   Ú__classcell__)r}   s   @r)   r5   r5   0  s”   ø… Ø,€NàEÓEØ4Ó4à*×>Ñ>Ø	Ð!2×!@Ñ!@ÐAØ	Ð0×AÑAÐBðBñ Ðð .2Ø48Ø.2Ø $Ø#'ð-
à*ð-
ð 2ð-
ð ,ð	-
ð
 ð-
ð !÷-
ñ -
r*   r5   N)r(   r   r?   r   )2Ú
__future__r   Útypingr   r   r   r   r   Ú r
   Ú_typingr   r   r   r   r   r   Úsqlr   r   r   Úsql._typingr   Úsql.baser   r   r   r   Úsql.dmlr   r   rg   Úsql.elementsr   r   r    r!   Úsql.expressionr"   Úsql.type_apir#   Úsql.visitorsr$   Úutil.typingr%   Ú__all__r&   rL   r=   r5   rJ   r*   r)   ú<module>rŽ      s¨   ðõ #å Ý Ý Ý Ý å Ý ,Ý /Ý ,Ý %Ý 'Ý Ý Ý Ý Ý ,Ý *Ý (Ý 0Ý 'Ý (Ý /Ý )Ý )Ý .Ý &Ý #Ý $Ý -Ý à
€óô(T
ˆ^ô T
ônP
�¨ô P
ôfÐ*ô ô8
Ð)õ 8
r*   