Sh3ll
OdayForums


Server : LiteSpeed
System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : claqxcrl ( 523)
PHP Version : 8.1.32
Disable Function : NONE
Directory :  /opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/__pycache__/dml.cpython-312.pyc
�

���g���X�dZddlmZddlmZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd	lm
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%ddl"m&Z&dd l"m'Z'dd!l"m(Z(dd"l"m)Z)dd#l"m*Z*dd$l"m+Z+dd%l"m,Z,dd&l"m-Z-dd'l"m.Z.dd(l/m0Z0dd)l/m1Z1dd*l/m2Z2dd+l/m3Z3dd,l/m4Z4dd-l5m6Z6dd.l5m7Z7dd/l5m8Z8dd0l5m9Z9dd1l5m:Z:dd2l5m;Z;dd3l5m<Z<dd4l5m=Z=dd5l5m>Z>dd6l?m@Z@dd7lAmBZBd8d9lmCZCd8dlmZd8d:lDmEZEd8d;lDmFZFer�dd<lmGZGdd=lmHZHdd>lmIZIdd?lmJZJdd@lmKZKddAlmLZLddBlmMZMddClmNZNddDlmOZOddElmPZPddFlmQZQddGlmRZRddHlmSZSddIlmTZUddJl"mVZVddKlWmXZXddLl/mYZYddMl5mZZZddNl5m[Z[ddOl5m\Z\ddPl5m]Z]dwdR�Z^dxdS�Z_dydT�Z`n6ej�dU�Z^ej�dV�Z_ej�dW�Z`edXe�Y�Zbeece2efZdee=e6e;fZeGdZ�dQe*�Zfe*j�d[d\�Gd]�d^ef��Zhe*j�d[d_�Gd`�daef��Zie*j�d[db�Gdc�ddef��ZjGde�dfej�e9e.e+e:e-e7e1�
ZlGdg�dhel�ZmGdi�djem�ZnGdk�dlene>e�ZoGdm�dn�ZpGdo�dpepem�ZqGdq�dreqe>e�ZrGds�dtepel�ZsGdu�dveqe>e�Zty)zzd
Provide :class:`_expression.Insert`, :class:`_expression.Update` and
:class:`_expression.Delete`.

�)�annotationsN)�Any)�cast)�Dict)�Iterable)�List)�MutableMapping)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�	coercions)�roles)�util)�_TP)�_unexpected_kw)�is_column_element)�is_named_from_clause)�_entity_namespace_key)�_exclusive_against)�
_from_objects)�_generative)�_select_iterables)�ColumnCollection)�	ColumnSet)�CompileState)�
DialectKWArgs)�
Executable)�
Generative)�HasCompileState)�BooleanClauseList)�
ClauseElement)�ColumnClause)�
ColumnElement)�Null)�Alias)�ExecutableReturnsRows)�
FromClause)�HasCTE)�HasPrefixes)�Join)�SelectLabelStyle)�TableClause)�TypedReturnsRows)�NullType)�InternalTraversal�)�exc)�Self)�	TypeGuard)�_ColumnExpressionArgument)�_ColumnsClauseArgument)�_DMLColumnArgument)�_DMLColumnKeyMapping)�_DMLTableArgument)�_T0)�_T1)�_T2)�_T3)�_T4)�_T5)�_T6)�_T7)�_TypedColumnClauseArgument)�ReadOnlyColumnCollection)�SQLCompiler)�KeyedColumnElement)�_ColumnsClauseElement)�_SelectIterable)�Select)�
Selectable�DMLStatec��y�N���dmls �C/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/sql/dml.py�isupdaterX`���c�c��yrSrTrUs rW�isdeleter\brYrZc��yrSrTrUs rW�isinsertr^drYrZrXr\r^�_T)�boundc�F�eZdZUdZdZded<dZded<dZded<dZd	ed
<ded<dZ	d
Z
d
Zd
Zded<						dd�Z
edd��Ze				dd��Zedd��Zer	ed d��Ze						d!d��Ze								d"d��Z				d#d�Zd$d�Zd$d�Zd%d�Zd&d�Zy)'rQTNz0Optional[MutableMapping[_DMLColumnElement, Any]]�_dict_parametersz6Optional[List[MutableMapping[_DMLColumnElement, Any]]]�_multi_parameters�-Optional[List[Tuple[_DMLColumnElement, Any]]]�_ordered_valuesz!Optional[List[_DMLColumnElement]]�_parameter_orderingr/�_primary_tableF�
UpdateBase�	statementc��t��rS��NotImplementedError)�selfri�compiler�kws    rW�__init__zDMLState.__init__�s
��"�#�#rZc�v�t|j�r|jjnd|jd�S)N)�name�table)rrsrr��clsris  rW�get_entity_descriptionzDMLState.get_entity_description�s3��
(�	���8����$�$���_�_�

�	
rZc�p�|jD�cgc]}|j|j|d���c}Scc}w)N)rr�type�expr)�_all_selected_columns�keyrx)ruri�cs   rW�!get_returning_column_descriptionsz*DMLState.get_returning_column_descriptions�sF���4�4�

�5��	�������
�
5�

�	
��
s�!3c�.�|jjSrS)rirs�rms rW�	dml_tablezDMLState.dml_table�s���~�~�#�#�#rZc��yrSrTrts  rW�get_plugin_classzDMLState.get_plugin_class�s��LOrZc
���|D���cgc]H}|j�D��cic]*\}}tjtj|�|��,c}}��Jc}}}Scc}}wcc}}}wrS)�itemsr�expectr�
DMLColumnRole)ruri�multi_kv_iterator�mapping�k�vs      rW�_get_multi_crud_kv_pairsz!DMLState._get_multi_crud_kv_pairs�sl��-�
�
-��$�M�M�O�
�+�D�A�q�� � ��!4�!4�a�8�!�;�+�
�-�
�	
��
��
s�A�/A�A�Ac���|D��cgc]\\}}tjtj|�|s|n.tjtj|t�d��f��^c}}Scc}}w)NT)�type_�is_crud)rr�rr��ExpressionElementRoler6)ruri�kv_iterator�needs_to_be_cacheabler�r�s      rW�_get_crud_kv_pairszDMLState._get_crud_kv_pairs�su��*$�
�$���1�� � ��!4�!4�a�8�1��"�)�)��3�3��&�j� $�	�
�$�
�	
��
s�A!A+c���g}ttj|j��}|d}|h}|j}|j
r&|t
|j
j��z
}|D]Y}t|�D]I}|j|j�s|j|�|j|j��K�[|j|dd�||fS)Nrr)�list�sql_util�tables_from_leftmostrs�_where_criteriarb�tuple�valuesr�intersection�_cloned_set�append�update�extend)	rmri�froms�
all_tables�
primary_table�seen�consider�crit�items	         rW�_make_extra_fromszDMLState._make_extra_froms�s���#%���(�7�7�	���H�I�
�"�1�
�
�����,�,��� � ���d�3�3�:�:�<�=�=�H��D�%�d�+���(�(��)9�)9�:��L�L��&����D�,�,�-�,��	���Z���^�$��e�#�#rZc�N�|jr|j|_d|_yy�NF)�_no_parameters�_valuesrb�rmris  rW�_process_valueszDMLState._process_values�s&�����$-�$5�$5�D�!�"'�D��rZc��|j�J�|jD�cic]
}|t���}}|jrd|_||_yJd��cc}w)NFz%This statement already has parameters)�
_select_namesr,r�rb)rmrirr�
parameterss    rW�_process_select_valueszDMLState._process_select_values�sk���&�&�2�2�2�%.�%<�%<�>
�%<�T�D�$�&�L�%<�	�>
����"'�D��$.�D�!�
B�A�A�5��>
s�Ac�b�tjd|jj�z��)Nz6%s construct does not support multiple parameter sets.)r9�InvalidRequestError�__visit_name__�upperr�s  rW�_no_multi_values_supportedz#DMLState._no_multi_values_supported�s2���%�%�
'�)2�)A�)A�)G�)G�)I�
J�
�	
rZc�,�tjd��)Nz�Can't mix single and multiple VALUES formats in one INSERT statement; one style appends to a list while the other replaces values, so the intent is ambiguous.)r9r�rs rW�_cant_mix_formats_errorz DMLState._cant_mix_formats_error�s���%�%�
�
�	
rZ)rirhrnrKror)rirh�return�Dict[str, Any])rirhr��List[Dict[str, Any]]�r��_DMLTableElement)rir%r�zType[DMLState])rirhr�z'Iterable[Dict[_DMLColumnArgument, Any]]r�z"List[Dict[_DMLColumnElement, Any]])rirhr�z(Iterable[Tuple[_DMLColumnArgument, Any]]r��boolr�z#List[Tuple[_DMLColumnElement, Any]])ri�DMLWhereBaser�z#Tuple[FromClause, List[FromClause]]�ri�
ValuesBaser��None)rir�r�r
)r�r
)�__name__�
__module__�__qualname__r�rb�__annotations__rcrerf�_supports_implicit_returningrXr\r^rp�classmethodrvr}�propertyr�rr�r�r�r�r�r�r�r�rTrZrWrQrQrsr���N�IM��F�M�	
���
�FJ�O�B�I�=A��:�A���#'� ��H��H��H���$�#�$�/:�$�BE�$�
�
��
��

�"�

�	�

��

��$��$��	�O�
�O��
��
�C�
�
,�	
��
��
��
�>�
� $�	
�

-�
��
�.$�%�$�	,�$�,(�
B�
�
rZ�default�insertc�h�eZdZdZdZdZ	d							d	d�Zejd
d��Z	dd�Z
dd�Zy)�InsertDMLStateTFc��||_|j|_|rd|_d|_|j
r|j
|�|j�|j|�|jr|j|�yy)NFT)rirsrgr�r^r�r�r�r��
_multi_values�_process_multi_values)rmrirn�disable_implicit_returningros     rWrpzInsertDMLState.__init__sv��#���'�o�o���%�05�D�-���
��"�"��'�'�	�2����(�� � ��+��"�"��&�&�y�1�#rZc��|jxsdD�cgc](}tjtj|d����*c}Scc}w)NrTT��as_key)rbrr�rr�)rm�cols  rW�_insert_col_keyszInsertDMLState._insert_col_keys$sL��
�,�,�2��2�
�2��
���U�0�0�#�d�C�2�
�	
��
s�-Ac��|jr d|_|j|_d|_y|jr|j	�yyr�)r��_has_multi_parametersr�rbr�r�s  rWr�zInsertDMLState._process_values,sC�����).�D�&�$-�$5�$5�D�!�"'�D��
�
'�
'��(�(�*�(rZc��|jD]�}|D���cgc]\}t|tj�r>t	|j
j|�D��cic]\}}|j|��c}}n|��^}}}}|jr*d|_d|_	||_
|jd|_��|js|j���|jsJ�|jj|���ycc}}wcc}}}w)NFTr)r��
isinstance�collections_abcr
�ziprsr|r{r�r�rcrbr�r�)rmrir��
parameter_setr|�value�multi_parameterss       rWr�z$InsertDMLState._process_multi_values4s��#�1�1�J�&0�
N�&0�M�"�-��1I�1I�J�),�I�O�O�,=�,=�}�(M��(M�H�A�u����u��(M��
'�'�&0�
�
N��"�"�&+��#�-1��*�)9��&�(,�(>�(>�q�(A��%��/�/��,�,�.��-�-�-�-��&�&�-�-�.>�?�-2����
Ns�AD
�C:�/D
�:D
N�F)ri�InsertrnrKr�r�ror)r�z	List[str]r�)r�r�r�r^�include_table_with_column_exprsr�rpr�memoized_propertyr�r�r�rTrZrWr�r�sh���H�&+�#�!��,1�	2��2��2�%)�	2�
�2�*
���
��
�+�@rZr�r�c�$�eZdZdZdZdd�Zdd�Zy)�UpdateDMLStateTFc�d�||_d|_|j�|j|�n;|j�|j|�n|jr|j|�|j|�\}}||_	||_
|x|_}t|xr|j�|_y�NT)rirXre�_process_ordered_valuesr�r�r�r�r�rg�_extra_froms�
is_multitabler��'render_table_with_column_in_update_fromr�)rmrirnro�t�ef�mts       rWrpzUpdateDMLState.__init__Ts���"�����
��$�$�0��(�(��3�
�
�
�
*�� � ��+�
�
$�
$��+�+�I�6��&�&�y�1���2�������"$�$���R�/3��C�8�C�C�0
��,rZc���|j}|jr=d|_|�J�t|�|_||_|D��cgc]\}}|��	c}}|_ytjd��cc}}w)NFzQCan only invoke ordered_values() once, and not mixed with any other values() call)rer��dictrbrfr9r�)rmrir�r{r�s     rWr�z&UpdateDMLState._process_ordered_valuesgsx���.�.�
����"'�D���)�)�)�$(��$4�D�!�#-�D� �>H�'I�j�
��U��j�'I�D�$��)�)�/��
��(Js�A+N)ri�UpdaternrKrorr�)r�r�r�rXr�rpr�rTrZrWr�r�Ns���H�&+�#�
�&
rZr��deletec��eZdZdZdd�Zy)�DeleteDMLStateTc�r�||_d|_|j|�\}}||_||_||_yr�)rir\r�rgr�r�)rmrirnror�r�s      rWrpzDeleteDMLState.__init__{s<��"�����
��&�&�y�1���2���������rZN)ri�DeleternrKror)r�r�r�r\rprTrZrWr�r�ws���H� rZr�c���eZdZUdZdZejZded<dZ	e
jZded<ded	<dZ
d
Zded<d
Zded
<dZded<dZ										d d�Zd!d�Zed"d��Zed
dd�							d#d��Zd$d�Zedd�							d%d��Z	d&					d'd�Zej4d(d��Zej4		d)d��Ze		d*							d+d��Zed,d��Zed-d��Z y
).rhzDForm the base for ``INSERT``, ``UPDATE``, and ``DELETE`` statements.�update_basez5util.immutabledict[Tuple[_DMLTableElement, str], str]�_hintsFr3�_label_styler�rsNz+Optional[Tuple[_ColumnsClauseElement, ...]]�_return_defaults_columns�_supplemental_returningrTz!Tuple[_ColumnsClauseElement, ...]�
_returningTc�V����|j���fd�|jD��y)Nc3�\�K�|]#}t|�r|j��������%y�w))�primary_key�foreign_keysN)r�_make_proxy)�.0r�r�
fromclauser�s  ���rW�	<genexpr>zAUpdateBase._generate_fromclause_column_proxies.<locals>.<genexpr>�s:�����(
�2�� ��%�	
�O�O���,�
�
�2�s�),)�_populate_separate_keysrz)rmr�columnsr�rs ` ``rW�#_generate_fromclause_column_proxiesz.UpdateBase._generate_fromclause_column_proxies�s(���	�'�'�(
��1�1�	(
�	
rZc��td��)z�Set the parameters for the statement.

        This method raises ``NotImplementedError`` on the base class,
        and is overridden by :class:`.ValuesBase` to provide the
        SET/VALUES clause of UPDATE and INSERT.

        z�params() is not supported for INSERT/UPDATE/DELETE statements. To set the values for an INSERT or UPDATE statement, use stmt.values(**parameters).rk)rm�argros   rW�paramszUpdateBase.params�s��"�
*�
�	
rZc�(�|j|�|S)aAdd dialect options to this INSERT/UPDATE/DELETE object.

        e.g.::

            upd = table.update().dialect_options(mysql_limit=10)

        .. versionadded: 1.4 - this method supersedes the dialect options
           associated with the constructor.


        )�_validate_dialect_kwargs)rm�opts  rW�with_dialect_optionszUpdateBase.with_dialect_options�s��	
�%�%�c�*��rZ)�supplemental_cols�sort_by_parameter_orderc�L�|jrZ|jrF|rDttj|j�jd�|D���|_nd|_ntd�|D��|_d|_|r(|jstjd��d|_	|rsd�|D�}|j�%ttj|��|_
|Sttj|jt|�z��|_
|S)aA$Make use of a :term:`RETURNING` clause for the purpose
        of fetching server-side expressions and defaults, for supporting
        backends only.

        .. deepalchemy::

            The :meth:`.UpdateBase.return_defaults` method is used by the ORM
            for its internal work in fetching newly generated primary key
            and server default values, in particular to provide the underyling
            implementation of the :paramref:`_orm.Mapper.eager_defaults`
            ORM feature as well as to allow RETURNING support with bulk
            ORM inserts.  Its behavior is fairly idiosyncratic
            and is not really intended for general use.  End users should
            stick with using :meth:`.UpdateBase.returning` in order to
            add RETURNING clauses to their INSERT, UPDATE and DELETE
            statements.

        Normally, a single row INSERT statement will automatically populate the
        :attr:`.CursorResult.inserted_primary_key` attribute when executed,
        which stores the primary key of the row that was just inserted in the
        form of a :class:`.Row` object with column names as named tuple keys
        (and the :attr:`.Row._mapping` view fully populated as well). The
        dialect in use chooses the strategy to use in order to populate this
        data; if it was generated using server-side defaults and / or SQL
        expressions, dialect-specific approaches such as ``cursor.lastrowid``
        or ``RETURNING`` are typically used to acquire the new primary key
        value.

        However, when the statement is modified by calling
        :meth:`.UpdateBase.return_defaults` before executing the statement,
        additional behaviors take place **only** for backends that support
        RETURNING and for :class:`.Table` objects that maintain the
        :paramref:`.Table.implicit_returning` parameter at its default value of
        ``True``. In these cases, when the :class:`.CursorResult` is returned
        from the statement's execution, not only will
        :attr:`.CursorResult.inserted_primary_key` be populated as always, the
        :attr:`.CursorResult.returned_defaults` attribute will also be
        populated with a :class:`.Row` named-tuple representing the full range
        of server generated
        values from that single row, including values for any columns that
        specify :paramref:`_schema.Column.server_default` or which make use of
        :paramref:`_schema.Column.default` using a SQL expression.

        When invoking INSERT statements with multiple rows using
        :ref:`insertmanyvalues <engine_insertmanyvalues>`, the
        :meth:`.UpdateBase.return_defaults` modifier will have the effect of
        the :attr:`_engine.CursorResult.inserted_primary_key_rows` and
        :attr:`_engine.CursorResult.returned_defaults_rows` attributes being
        fully populated with lists of :class:`.Row` objects representing newly
        inserted primary key values as well as newly inserted server generated
        values for each row inserted. The
        :attr:`.CursorResult.inserted_primary_key` and
        :attr:`.CursorResult.returned_defaults` attributes will also continue
        to be populated with the first row of these two collections.

        If the backend does not support RETURNING or the :class:`.Table` in use
        has disabled :paramref:`.Table.implicit_returning`, then no RETURNING
        clause is added and no additional data is fetched, however the
        INSERT, UPDATE or DELETE statement proceeds normally.

        E.g.::

            stmt = table.insert().values(data="newdata").return_defaults()

            result = connection.execute(stmt)

            server_created_at = result.returned_defaults["created_at"]

        When used against an UPDATE statement
        :meth:`.UpdateBase.return_defaults` instead looks for columns that
        include :paramref:`_schema.Column.onupdate` or
        :paramref:`_schema.Column.server_onupdate` parameters assigned, when
        constructing the columns that will be included in the RETURNING clause
        by default if explicit columns were not specified. When used against a
        DELETE statement, no columns are included in RETURNING by default, they
        instead must be specified explicitly as there are no columns that
        normally change values when a DELETE statement proceeds.

        .. versionadded:: 2.0  :meth:`.UpdateBase.return_defaults` is supported
           for DELETE statements also and has been moved from
           :class:`.ValuesBase` to :class:`.UpdateBase`.

        The :meth:`.UpdateBase.return_defaults` method is mutually exclusive
        against the :meth:`.UpdateBase.returning` method and errors will be
        raised during the SQL compilation process if both are used at the same
        time on one statement. The RETURNING clause of the INSERT, UPDATE or
        DELETE statement is therefore controlled by only one of these methods
        at a time.

        The :meth:`.UpdateBase.return_defaults` method differs from
        :meth:`.UpdateBase.returning` in these ways:

        1. :meth:`.UpdateBase.return_defaults` method causes the
           :attr:`.CursorResult.returned_defaults` collection to be populated
           with the first row from the RETURNING result. This attribute is not
           populated when using :meth:`.UpdateBase.returning`.

        2. :meth:`.UpdateBase.return_defaults` is compatible with existing
           logic used to fetch auto-generated primary key values that are then
           populated into the :attr:`.CursorResult.inserted_primary_key`
           attribute. By contrast, using :meth:`.UpdateBase.returning` will
           have the effect of the :attr:`.CursorResult.inserted_primary_key`
           attribute being left unpopulated.

        3. :meth:`.UpdateBase.return_defaults` can be called against any
           backend. Backends that don't support RETURNING will skip the usage
           of the feature, rather than raising an exception, *unless*
           ``supplemental_cols`` is passed. The return value
           of :attr:`_engine.CursorResult.returned_defaults` will be ``None``
           for backends that don't support RETURNING or for which the target
           :class:`.Table` sets :paramref:`.Table.implicit_returning` to
           ``False``.

        4. An INSERT statement invoked with executemany() is supported if the
           backend database driver supports the
           :ref:`insertmanyvalues <engine_insertmanyvalues>`
           feature which is now supported by most SQLAlchemy-included backends.
           When executemany is used, the
           :attr:`_engine.CursorResult.returned_defaults_rows` and
           :attr:`_engine.CursorResult.inserted_primary_key_rows` accessors
           will return the inserted defaults and primary keys.

           .. versionadded:: 1.4 Added
              :attr:`_engine.CursorResult.returned_defaults_rows` and
              :attr:`_engine.CursorResult.inserted_primary_key_rows` accessors.
              In version 2.0, the underlying implementation which fetches and
              populates the data for these attributes was generalized to be
              supported by most backends, whereas in 1.4 they were only
              supported by the ``psycopg2`` driver.


        :param cols: optional list of column key names or
         :class:`_schema.Column` that acts as a filter for those columns that
         will be fetched.
        :param supplemental_cols: optional list of RETURNING expressions,
          in the same form as one would pass to the
          :meth:`.UpdateBase.returning` method. When present, the additional
          columns will be included in the RETURNING clause, and the
          :class:`.CursorResult` object will be "rewound" when returned, so
          that methods like :meth:`.CursorResult.all` will return new rows
          mostly as though the statement used :meth:`.UpdateBase.returning`
          directly. However, unlike when using :meth:`.UpdateBase.returning`
          directly, the **order of the columns is undefined**, so can only be
          targeted using names or :attr:`.Row._mapping` keys; they cannot
          reliably be targeted positionally.

          .. versionadded:: 2.0

        :param sort_by_parameter_order: for a batch INSERT that is being
         executed against multiple parameter sets, organize the results of
         RETURNING so that the returned rows correspond to the order of
         parameter sets passed in.  This applies only to an :term:`executemany`
         execution for supporting dialects and typically makes use of the
         :term:`insertmanyvalues` feature.

         .. versionadded:: 2.0.10

         .. seealso::

            :ref:`engine_insertmanyvalues_returning_order` - background on
            sorting of RETURNING rows for bulk INSERT

        .. seealso::

            :meth:`.UpdateBase.returning`

            :attr:`_engine.CursorResult.returned_defaults`

            :attr:`_engine.CursorResult.returned_defaults_rows`

            :attr:`_engine.CursorResult.inserted_primary_key`

            :attr:`_engine.CursorResult.inserted_primary_key_rows`

        c3�dK�|](}tjtj|����*y�wrS�rr�r�ColumnsClauseRole�rr|s  rWrz-UpdateBase.return_defaults.<locals>.<genexpr>�s,����I�!%�A�"�(�(��)@�)@�!�D�!%���.0rTc3�dK�|](}tjtj|����*y�wrSrrs  rWrz-UpdateBase.return_defaults.<locals>.<genexpr>�s'����2�FJ��	� � ��!8�!8�!�<�d�rTz]The 'sort_by_parameter_order' argument to return_defaults() only applies to INSERT statementsc3�dK�|](}tjtj|����*y�wrSrrs  rWrz-UpdateBase.return_defaults.<locals>.<genexpr>�s+����$�*�A�� � ��!8�!8�!�<�*�r)�_return_defaultsr�r�r�
OrderedSet�union�	is_insertr9�
ArgumentError�_sort_by_parameter_orderr��unique_list)rmrr�cols�supplemental_col_tups     rW�return_defaultszUpdateBase.return_defaults�s.��n� � ��,�,��05��O�O�D�$A�$A�B�H�H�I�!%�I��1��-�13��-�,1�2�FJ�2�-�D�)�!%���"��>�>��'�'�J���-1�D�)��$�*�$� �
�+�+�3�/4��$�$�%9�:�0��,���05��$�$��4�4�� 4�5�6��0��,��rZc��y)z�Return ``True`` if this :class:`.ReturnsRows` is
        'derived' from the given :class:`.FromClause`.

        Since these are DMLs, we dont want such statements ever being adapted
        so we return False for derives.

        FrT)rmrs  rW�is_derived_fromzUpdateBase.is_derived_from�s��rZ�rc��|rtd|��|jrtjd��|xjtd�|D��z
c_|r(|jstjd��d|_|S)aRAdd a :term:`RETURNING` or equivalent clause to this statement.

        e.g.:

        .. sourcecode:: pycon+sql

            >>> stmt = (
            ...     table.update()
            ...     .where(table.c.data == "value")
            ...     .values(status="X")
            ...     .returning(table.c.server_flag, table.c.updated_timestamp)
            ... )
            >>> print(stmt)
            {printsql}UPDATE some_table SET status=:status
            WHERE some_table.data = :data_1
            RETURNING some_table.server_flag, some_table.updated_timestamp

        The method may be invoked multiple times to add new entries to the
        list of expressions to be returned.

        .. versionadded:: 1.4.0b2 The method may be invoked multiple times to
         add new entries to the list of expressions to be returned.

        The given collection of column expressions should be derived from the
        table that is the target of the INSERT, UPDATE, or DELETE.  While
        :class:`_schema.Column` objects are typical, the elements can also be
        expressions:

        .. sourcecode:: pycon+sql

            >>> stmt = table.insert().returning(
            ...     (table.c.first_name + " " + table.c.last_name).label("fullname")
            ... )
            >>> print(stmt)
            {printsql}INSERT INTO some_table (first_name, last_name)
            VALUES (:first_name, :last_name)
            RETURNING some_table.first_name || :first_name_1 || some_table.last_name AS fullname

        Upon compilation, a RETURNING clause, or database equivalent,
        will be rendered within the statement.   For INSERT and UPDATE,
        the values are the newly inserted/updated values.  For DELETE,
        the values are those of the rows which were deleted.

        Upon execution, the values of the columns to be returned are made
        available via the result set and can be iterated using
        :meth:`_engine.CursorResult.fetchone` and similar.
        For DBAPIs which do not
        natively support returning values (i.e. cx_oracle), SQLAlchemy will
        approximate this behavior at the result level so that a reasonable
        amount of behavioral neutrality is provided.

        Note that not all databases/DBAPIs
        support RETURNING.   For those backends with no support,
        an exception is raised upon compilation and/or execution.
        For those who do support it, the functionality across backends
        varies greatly, including restrictions on executemany()
        and other statements which return multiple rows. Please
        read the documentation notes for the database in use in
        order to determine the availability of RETURNING.

        :param \*cols: series of columns, SQL expressions, or whole tables
         entities to be returned.
        :param sort_by_parameter_order: for a batch INSERT that is being
         executed against multiple parameter sets, organize the results of
         RETURNING so that the returned rows correspond to the order of
         parameter sets passed in.  This applies only to an :term:`executemany`
         execution for supporting dialects and typically makes use of the
         :term:`insertmanyvalues` feature.

         .. versionadded:: 2.0.10

         .. seealso::

            :ref:`engine_insertmanyvalues_returning_order` - background on
            sorting of RETURNING rows for bulk INSERT (Core level discussion)

            :ref:`orm_queryguide_bulk_insert_returning_ordered` - example of
            use with :ref:`orm_queryguide_bulk_insert` (ORM level discussion)

        .. seealso::

          :meth:`.UpdateBase.return_defaults` - an alternative method tailored
          towards efficient fetching of server-side defaults and triggers
          for single-row INSERTs or UPDATEs.

          :ref:`tutorial_insert_returning` - in the :ref:`unified_tutorial`

        zUpdateBase.returning()z9return_defaults() is already configured on this statementc3�dK�|](}tjtj|����*y�wrSrrs  rWrz'UpdateBase.returning.<locals>.<genexpr>)s'����!
�BF�Q�I���U�4�4�a�8�$�rzWThe 'sort_by_parameter_order' argument to returning() only applies to INSERT statementsT)	rrr9r�r�r�rrr)rmrr �_UpdateBase__kws    rW�	returningzUpdateBase.returning�s���~� �!9�4�@�@�� � ��)�)�K��
�	
���5�!
�BF�!
�
�	
��#��>�>��'�'�8���-1�D�)��rZc�<�|jj||��S)N)�require_embedded)�exported_columns�corresponding_column)rm�columnr+s   rWr-zUpdateBase.corresponding_column5s(���$�$�9�9��%5�:�
�	
rZc�R�t|j�D�cgc]}|��c}Scc}wrS)r r�)rmr|s  rWrzz UpdateBase._all_selected_columns<s%��,�T�_�_�=�>�=�a��=�>�>��>s�	$c�V�td�|jD��j�S)zxReturn the RETURNING columns as a column collection for this
        statement.

        .. versionadded:: 1.4

        c3�NK�|]}t|�r|j|f���y�wrS)rr{rs  rWrz.UpdateBase.exported_columns.<locals>.<genexpr>Js(���� 
�/�� ��#��U�U�A�J�/�s�#%)r!rz�as_readonlyrs rWr,zUpdateBase.exported_columns@s-�� � 
��/�/� 
�
��+�-�		rZc��|�
|j}n$tjtj|�}|j
j
||f|i�|_|S)aAdd a table hint for a single table to this
        INSERT/UPDATE/DELETE statement.

        .. note::

         :meth:`.UpdateBase.with_hint` currently applies only to
         Microsoft SQL Server.  For MySQL INSERT/UPDATE/DELETE hints, use
         :meth:`.UpdateBase.prefix_with`.

        The text of the hint is rendered in the appropriate
        location for the database backend in use, relative
        to the :class:`_schema.Table` that is the subject of this
        statement, or optionally to that of the given
        :class:`_schema.Table` passed as the ``selectable`` argument.

        The ``dialect_name`` option will limit the rendering of a particular
        hint to a particular backend. Such as, to add a hint
        that only takes effect for SQL Server::

            mytable.insert().with_hint("WITH (PAGLOCK)", dialect_name="mssql")

        :param text: Text of the hint.
        :param selectable: optional :class:`_schema.Table` that specifies
         an element of the FROM clause within an UPDATE or DELETE
         to be the subject of the hint - applies only to certain backends.
        :param dialect_name: defaults to ``*``, if specified as the name
         of a particular dialect, will apply these hints only when
         that dialect is in use.
        )rsrr�r�DMLTableRoler�r)rm�text�
selectable�dialect_names    rW�	with_hintzUpdateBase.with_hintPsQ��H�����J�"�)�)�%�*<�*<�j�I�J��k�k�'�'�*�l�)C�T�(J�K����rZc�P�tj|�j}||�S)a=Return a :term:`plugin-enabled` description of the table and/or
        entity which this DML construct is operating against.

        This attribute is generally useful when using the ORM, as an
        extended structure which includes information about mapped
        entities is returned.  The section :ref:`queryguide_inspection`
        contains more background.

        For a Core statement, the structure returned by this accessor
        is derived from the :attr:`.UpdateBase.table` attribute, and
        refers to the :class:`.Table` being inserted, updated, or deleted::

            >>> stmt = insert(user_table)
            >>> stmt.entity_description
            {
                "name": "user_table",
                "table": Table("user_table", ...)
            }

        .. versionadded:: 1.4.33

        .. seealso::

            :attr:`.UpdateBase.returning_column_descriptions`

            :attr:`.Select.column_descriptions` - entity information for
            a :func:`.select` construct

            :ref:`queryguide_inspection` - ORM background

        )rQr�rv�rm�meths  rW�entity_descriptionzUpdateBase.entity_description{s%��B�(�(��.�E�E���D�z�rZc�P�tj|�j}||�S)a�Return a :term:`plugin-enabled` description of the columns
        which this DML construct is RETURNING against, in other words
        the expressions established as part of :meth:`.UpdateBase.returning`.

        This attribute is generally useful when using the ORM, as an
        extended structure which includes information about mapped
        entities is returned.  The section :ref:`queryguide_inspection`
        contains more background.

        For a Core statement, the structure returned by this accessor is
        derived from the same objects that are returned by the
        :attr:`.UpdateBase.exported_columns` accessor::

            >>> stmt = insert(user_table).returning(user_table.c.id, user_table.c.name)
            >>> stmt.entity_description
            [
                {
                    "name": "id",
                    "type": Integer,
                    "expr": Column("id", Integer(), table=<user>, ...)
                },
                {
                    "name": "name",
                    "type": String(),
                    "expr": Column("name", String(), table=<user>, ...)
                },
            ]

        .. versionadded:: 1.4.33

        .. seealso::

            :attr:`.UpdateBase.entity_description`

            :attr:`.Select.column_descriptions` - entity information for
            a :func:`.select` construct

            :ref:`queryguide_inspection` - ORM background

        )rQr�r}r:s  rW�returning_column_descriptionsz(UpdateBase.returning_column_descriptions�s-��T�(�(��
�
+�
+�	
��D�z�rZ)
rr/rz.ColumnCollection[str, KeyedColumnElement[Any]]r�r"rzSet[KeyedColumnElement[Any]]r�r�)r	rrorr�r
)r
rr�r:)r r>rz&Optional[Iterable[_DMLColumnArgument]]rr�r�r:)rzOptional[FromClause]r�r�)r �_ColumnsClauseArgument[Any]rr�r(rr�rhr�)r.zKeyedColumnElement[Any]r+r�r��Optional[ColumnElement[Any]])r�rN)r�z;ReadOnlyColumnCollection[Optional[str], ColumnElement[Any]])N�*)r5�strr6zOptional[_DMLTableArgument]r7rBr�r:)r�r�)r�r�)!r�r�r��__doc__r�r�
EMPTY_DICTr�r��named_with_columnr3�LABEL_STYLE_DISAMBIGUATE_ONLYr�rr�r�r��is_dmlrr
rrr"r$r)r-�ro_memoized_propertyrzr,r8r�r<r>rTrZrWrhrh�s3��O�"�N�	
����A����	�6�6��"��������I��LP��H�O�46�J�1�6�
�F�

��

�@�

��	

�
3�

�
�


�
��
��
��EI�(-�	d�!�d�B�d�"&�	d�

�d��d�L��).�n�*�n�"&�n��	n�

�n��n�bIN�
�-�
�AE�
�	%�
�
���?��?�
���
�	D�
��
��37��	(��(�0�(��	(�

�(��(�T�!��!�F�,��,rZrhc���eZdZUdZdZdZdZded<	dZded<	dZ	d	ed
<dZ
ded
<dZded<dZded<dZ
ded<dd�Zeeddddd���						dd���Zy)r�zTSupplies support for :meth:`.ValuesBase.values` to
    INSERT and UPDATE constructs.�values_baseFNzOptional[Select[Any]]�selectzOptional[ClauseElement]�_post_values_clausez4Optional[util.immutabledict[_DMLColumnElement, Any]]r�rTzRTuple[Union[Sequence[Dict[_DMLColumnElement, Any]], Sequence[Sequence[Any]]], ...]r�rdrezOptional[List[str]]r�r��_inlinec�Z�tjtj||��|_y�N��apply_propagate_attrs�rr�rr4rs�rmrss  rWrpzValuesBase.__init__��!���%�%�����T�
��
rZz,This construct already inserts from a SELECT�1This statement already has ordered values present)r�re)�msgsc���|�r5|d}|rtjd��t|�dkDrtjd��t|tj
�r�|rQt|dt�r>tj|�j}|xj|||�fz
c_
|S|r1t|dttf�r|xj|fz
c_
|Strt|t�sJ�t|j j"|�D��cic]\}}|j$|��}}}n#t'd|�}|rtjd��tj|�j(}t
|||j+�d��}|j,r"|j,j/|�|_|St1j2|�|_|Scc}}w)aYSpecify a fixed VALUES clause for an INSERT statement, or the SET
        clause for an UPDATE.

        Note that the :class:`_expression.Insert` and
        :class:`_expression.Update`
        constructs support
        per-execution time formatting of the VALUES and/or SET clauses,
        based on the arguments passed to :meth:`_engine.Connection.execute`.
        However, the :meth:`.ValuesBase.values` method can be used to "fix" a
        particular set of parameters into the statement.

        Multiple calls to :meth:`.ValuesBase.values` will produce a new
        construct, each one with the parameter list modified to include
        the new parameters sent.  In the typical case of a single
        dictionary of parameters, the newly passed keys will replace
        the same keys in the previous construct.  In the case of a list-based
        "multiple values" construct, each new list of values is extended
        onto the existing list of values.

        :param \**kwargs: key value pairs representing the string key
          of a :class:`_schema.Column`
          mapped to the value to be rendered into the
          VALUES or SET clause::

                users.insert().values(name="some name")

                users.update().where(users.c.id == 5).values(name="some name")

        :param \*args: As an alternative to passing key/value parameters,
         a dictionary, tuple, or list of dictionaries or tuples can be passed
         as a single positional argument in order to form the VALUES or
         SET clause of the statement.  The forms that are accepted vary
         based on whether this is an :class:`_expression.Insert` or an
         :class:`_expression.Update` construct.

         For either an :class:`_expression.Insert` or
         :class:`_expression.Update`
         construct, a single dictionary can be passed, which works the same as
         that of the kwargs form::

            users.insert().values({"name": "some name"})

            users.update().values({"name": "some new name"})

         Also for either form but more typically for the
         :class:`_expression.Insert` construct, a tuple that contains an
         entry for every column in the table is also accepted::

            users.insert().values((5, "some name"))

         The :class:`_expression.Insert` construct also supports being
         passed a list of dictionaries or full-table-tuples, which on the
         server will render the less common SQL syntax of "multiple values" -
         this syntax is supported on backends such as SQLite, PostgreSQL,
         MySQL, but not necessarily others::

            users.insert().values(
                [
                    {"name": "some name"},
                    {"name": "some other name"},
                    {"name": "yet another name"},
                ]
            )

         The above form would render a multiple VALUES statement similar to:

         .. sourcecode:: sql

                INSERT INTO users (name) VALUES
                                (:name_1),
                                (:name_2),
                                (:name_3)

         It is essential to note that **passing multiple values is
         NOT the same as using traditional executemany() form**.  The above
         syntax is a **special** syntax not typically used.  To emit an
         INSERT statement against multiple rows, the normal method is
         to pass a multiple values list to the
         :meth:`_engine.Connection.execute`
         method, which is supported by all database backends and is generally
         more efficient for a very large number of parameters.

           .. seealso::

               :ref:`tutorial_multiple_parameters` - an introduction to
               the traditional Core method of multiple parameter set
               invocation for INSERTs and other statements.

          The UPDATE construct also supports rendering the SET parameters
          in a specific order.  For this feature refer to the
          :meth:`_expression.Update.ordered_values` method.

           .. seealso::

              :meth:`_expression.Update.ordered_values`


        rz;Can't pass positional and kwargs to values() simultaneouslyrzWOnly a single dictionary/tuple or list of dictionaries/tuples is accepted positionally.zDict[_DMLColumnArgument, Any]T)r9r�lenr�r�r
r�rQr�r�r�r�r�rr�r�rsr|r{rr�r�r�rr�
immutabledict)	rm�args�kwargsr	�multi_kv_generatorr|r��kv_generator�coerced_args	         rWr�zValuesBase.values�s���h��q�'�C���'�'�%����T��Q���'�'�D���
�C��!9�!9�:��:�c�!�f�d�3�)1�)B�)B��*�.�.�'��&�&�+=�d�C�+H�*J�J�&��K��:�c�!�f�t�U�m�<��&�&�3�&�0�&��K� �&�d�F�3�3�3�58��
�
���c�4J�K�4J���5�q�u�u�e�|�4J��K�
�6��?�C���'�'�D��� �0�0��6�I�I���<��c�i�i�k�4�@�A���<�<��<�<�-�-�k�:�D�L��� �-�-�k�:�D�L����1Ls�G&�rsr@)rZz/Union[_DMLColumnKeyMapping[Any], Sequence[Any]]r[rr�r:)r�r�r�rCr��_supports_multi_parametersrKr�rLr�r�rer�rMrprrr�rTrZrWr�r��s���%�#�N�!&��$(�F�!�(�4�37��0�7�)�EI�G�
A�H�	�
���FJ�O�B�I�)-�M�&�-��G�T��
�
����K� �
��g�
�g��
g�
�g���grZr�c
���eZdZUdZdZdZdZdZdZde	d<dZ
de	d	<d	ejfd
ejfdejfdejfd
ej fdejfdejfdej"fdej$fdejfdej"fdejfgej(zej,zej0zej4zZd"�fd�Zed#d��Ze	d$							d%d��Ze r�e!dd�					d&d��Z"e!dd�							d'd��Z"e!dd�									d(d��Z"e!dd�											d)d��Z"e!dd�													d*d��Z"e!dd�															d+d��Z"e!dd�																	d,d��Z"e!dd�																			d-d��Z"e!dd�							d.d ��Z"dd�							d.d!�Z"�xZ#S�xZ#S)/r�z�Represent an INSERT construct.

    The :class:`_expression.Insert` object is created using the
    :func:`_expression.insert()` function.

    r�TNFr�rr4rsrMr�r�r�rKrLr�r�rr�c�$��t�|�|�yrS��superrp�rmrs�	__class__s  �rWrpzInsert.__init__�����
����rZc��d|_|S)a�Make this :class:`_expression.Insert` construct "inline" .

        When set, no attempt will be made to retrieve the
        SQL-generated default values to be provided within the statement;
        in particular,
        this allows SQL expressions to be rendered 'inline' within the
        statement without the need to pre-execute them beforehand; for
        backends that support "returning", this turns off the "implicit
        returning" feature for the statement.


        .. versionchanged:: 1.4 the :paramref:`_expression.Insert.inline`
           parameter
           is now superseded by the :meth:`_expression.Insert.inline` method.

        T�rMrs rW�inlinez
Insert.inline�s��$����rZc�2�|jrtjd��|D�cgc](}tjt
j|d����*c}|_d|_||_	tjt
j|�|_|Scc}w)a+Return a new :class:`_expression.Insert` construct which represents
        an ``INSERT...FROM SELECT`` statement.

        e.g.::

            sel = select(table1.c.a, table1.c.b).where(table1.c.c > 5)
            ins = table2.insert().from_select(["a", "b"], sel)

        :param names: a sequence of string column names or
         :class:`_schema.Column`
         objects representing the target columns.
        :param select: a :func:`_expression.select` construct,
         :class:`_expression.FromClause`
         or other construct which resolves into a
         :class:`_expression.FromClause`,
         such as an ORM :class:`_query.Query` object, etc.  The order of
         columns returned from this FROM clause should correspond to the
         order of columns sent as the ``names`` parameter;  while this
         is not checked before passing along to the database, the database
         would normally raise an exception if these column lists don't
         correspond.
        :param include_defaults: if True, non-server default values and
         SQL expressions as specified on :class:`_schema.Column` objects
         (as documented in :ref:`metadata_defaults_toplevel`) not
         otherwise specified in the list of names will be rendered
         into the INSERT and SELECT statements, so that these values are also
         included in the data to be inserted.

         .. note:: A Python-side default that uses a Python callable function
            will only be invoked **once** for the whole statement, and **not
            per row**.

        z0This construct already inserts value expressionsTr�)r�r9r�rr�rr�r�rM�#include_insert_from_select_defaults�
DMLSelectRolerK)rm�namesrK�include_defaultsrrs     rW�from_selectzInsert.from_select�s���R�<�<��)�)�B��
��
���
���U�0�0�$�t�D��
������3C��0��&�&�u�':�':�F�C������
s�-Br%c��yrSrT)rm�
_Insert__ent0rs   rWr)zInsert.returning'���+.rZc��yrSrT)rmrr�
_Insert__ent1rs    rWr)zInsert.returning,s��03rZc��yrSrT)rmrrru�
_Insert__ent2rs     rWr)zInsert.returning5s��58rZc��yrSrT)rmrrrurw�
_Insert__ent3rs      rWr)zInsert.returning?s��:=rZc��yrSrT)rmrrrurwry�
_Insert__ent4rs       rWr)zInsert.returningJs��?BrZc��yrSrT)rmrrrurwryr{�
_Insert__ent5rs        rWr)zInsert.returningVs	��DGrZc��yrSrT)	rmrrrurwryr{r}�
_Insert__ent6rs	         rWr)zInsert.returningcs	��ILrZc	��yrSrT)
rmrrrurwryr{r}r�
_Insert__ent7rs
          rWr)zInsert.returningqs��rZc��yrSrT�rmrr �_Insert__kws    rWr)zInsert.returning�s��$'rZc��yrSrTr�s    rWr)zInsert.returning�s��
$'rZr_�r�r:)T)rnzSequence[_DMLColumnArgument]rKrPror�r�r:)rr�
_TCCA[_T0]rr�r�zReturningInsert[Tuple[_T0]])rrr�ru�
_TCCA[_T1]rr�r�z ReturningInsert[Tuple[_T0, _T1]])
rrr�rur�rw�
_TCCA[_T2]rr�r�z%ReturningInsert[Tuple[_T0, _T1, _T2]])rrr�rur�rwr�ry�
_TCCA[_T3]rr�r�z*ReturningInsert[Tuple[_T0, _T1, _T2, _T3]])rrr�rur�rwr�ryr�r{�
_TCCA[_T4]rr�r�z/ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4]])rrr�rur�rwr�ryr�r{r�r}�
_TCCA[_T5]rr�r�z4ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]])rrr�rur�rwr�ryr�r{r�r}r�r�
_TCCA[_T6]rr�r�z9ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]])rrr�rur�rwr�ryr�r{r�r}r�rr�r��
_TCCA[_T7]rr�r�z>ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]])r r?rr�r�rr�zReturningInsert[Any])$r�r�r�rCr�r`rKrlrr�rr7�dp_clauseelement�
dp_boolean�dp_string_list�
dp_dml_values�dp_dml_multi_values�dp_clauseelement_tuple�dp_table_hint_listr1� _has_prefixes_traverse_internalsr$�"_dialect_kwargs_traverse_internalsr%�_executable_traverse_internalsr0�_has_ctes_traverse_internals�_traverse_internalsrprrjrprrr)�
__classcell__�rfs@rWr�r��s������N�!%��
�F�*/�'�%*��d�*��I����'�8�8�9�
�)�4�4�5�
�/�>�>�?�
�)�7�7�8�
�/�C�C�D�
�(�9�9�:�
"�$5�$F�$F�G�
�,�C�C�D�
�(�;�;�<�
�!2�!=�!=�>�*�!�8�8�
�(�):�)E�)E�F�	
�"�
6�
6�#	7�$�
:�
:�%	;�&�
3�
3�'	4�(�
-�
-�)	.��0 �����(�
"&�	4�+�4��4��	4�

�4��4�l�
�IN�	.�$�	.�BF�	.�
(�	.�
�	.�
�-2�	3��	3��	3�
&*�	3�.�
	3�
�	3�
�-2�
	8��	8��	8��		8�&*�
	8�3�	8�
�	8�
�-2�	=��	=��	=��		=�
�	=�&*�	=�8�	=�
�	=�
�-2�		B��		B��		B��			B�
�		B��
		B�&*�		B�=�		B�
�		B�
�-2�
	G��
	G��
	G��	
	G�
�
	G��
	G��
	G�&*�
	G�B�
	G�
�
	G�
�-2�	L��	L��	L��		L�
�	L��
	L��	L��	L�&*�	L�G�	L�
�	L�
�-2�	��	��	��		�
�	��
	��	��	��	�&*�	�
�	�
�	�$
�-2�	'�.�	'�&*�	'��		'�
"�	'�
�	'�-2�	'�.�	'�&*�	'��		'�
"�	'�WrZr�c��eZdZdZy)�ReturningInsertz�Typing-only class that establishes a generic type form of
    :class:`.Insert` which tracks returned column types.

    This datatype is delivered when calling the
    :meth:`.Insert.returning` method.

    .. versionadded:: 2.0

    N�r�r�r�rCrTrZrWr�r�����rZr�c�b�eZdZUded<dZded<edd��Zd
d�Zdd�Zdd	�Z	e
dd
��Zy)r�r�rsrTzTuple[ColumnElement[Any], ...]r�c��|D]>}tjtj||��}|xj|fz
c_�@|S)a�Return a new construct with the given expression(s) added to
        its WHERE clause, joined to the existing clause via AND, if any.

        Both :meth:`_dml.Update.where` and :meth:`_dml.Delete.where`
        support multiple-table forms, including database-specific
        ``UPDATE...FROM`` as well as ``DELETE..USING``.  For backends that
        don't have multiple-table support, a backend agnostic approach
        to using multiple tables is to make use of correlated subqueries.
        See the linked tutorial sections below for examples.

        .. seealso::

            :ref:`tutorial_correlated_updates`

            :ref:`tutorial_update_from`

            :ref:`tutorial_multi_table_deletes`

        rP)rr�r�WhereHavingRoler�)rm�whereclause�	criterion�where_criterias    rW�wherezDMLWhereBase.where�sH��,%�I�1:�1A�1A��%�%�y��2�N�
� � �^�$5�5� �	%�
�rZc� �|j|�S)zbA synonym for the :meth:`_dml.DMLWhereBase.where` method.

        .. versionadded:: 1.4

        )r�)rm�criterias  rW�filterzDMLWhereBase.filter�s���t�z�z�8�$�$rZc��|jSrS)rsrs rW�_filter_by_zerozDMLWhereBase._filter_by_zero�s���z�z�rZc��|j�}|j�D��cgc]\}}t||�|k(��}}}|j|�Scc}}w)zWapply the given filtering criterion as a WHERE clause
        to this select.

        )r�r�rr�)rmr[�from_entityr{r��clausess      rW�	filter_byzDMLWhereBase.filter_by�sb��
�*�*�,��%�l�l�n�
�,�
��U�
"�+�s�3�u�<�,�	�
��t�{�{�G�$�$��	
s�Ac�@�tj|j�S)aReturn the completed WHERE clause for this :class:`.DMLWhereBase`
        statement.

        This assembles the current collection of WHERE criteria
        into a single :class:`_expression.BooleanClauseList` construct.


        .. versionadded:: 1.4

        )r(�_construct_for_whereclauser�rs rWr�zDMLWhereBase.whereclause�s ��!�;�;�� � �
�	
rZN)r�z_ColumnExpressionArgument[bool]r�r:)r�z roles.ExpressionElementRole[Any]r�r:r�)r[rr�r:)r�r@)r�r�r�r�r�rr�r�r�r�r�r�rTrZrWr�r��sH����68�O�3�8�����8%��%��
��
rZr�c
�$��eZdZdZdZdZdejfdejfdejfdejfdejfd	ejfd
ejfdejfdejfg	e
jzej zej$zej(zZd�fd
�Zedd��Zedd��Zer�e				dd��Ze						dd��Ze								dd��Ze										d d��Ze												d!d��Ze														d"d��Ze																d#d��Ze																		d$d��Ze						d%d��Z						d%d�Z�xZS�xZS)&r�z�Represent an Update construct.

    The :class:`_expression.Update` object is created using the
    :func:`_expression.update()` function.

    r�Trsr�rMrer�r�r�rr�c�$��t�|�|�yrSrcres  �rWrpzUpdate.__init__
rgrZc���|jrtjd��|jrtjd��tj|�j}|||d�|_|S)a�Specify the VALUES clause of this UPDATE statement with an explicit
        parameter ordering that will be maintained in the SET clause of the
        resulting UPDATE statement.

        E.g.::

            stmt = table.update().ordered_values(("name", "ed"), ("ident", "foo"))

        .. seealso::

           :ref:`tutorial_parameter_ordered_updates` - full example of the
           :meth:`_expression.Update.ordered_values` method.

        .. versionchanged:: 1.4 The :meth:`_expression.Update.ordered_values`
           method
           supersedes the
           :paramref:`_expression.update.preserve_parameter_order`
           parameter, which will be removed in SQLAlchemy 2.0.

        z)This statement already has values presentrUT)r�r9rrerQr�r�)rmrZr]s   rW�ordered_valueszUpdate.ordered_valuessp��,�<�<��#�#�;��
��
!�
!��#�#�C��
� �0�0��6�I�I��+�D�$��=����rZc��d|_|S)aJMake this :class:`_expression.Update` construct "inline" .

        When set, SQL defaults present on :class:`_schema.Column`
        objects via the
        ``default`` keyword will be compiled 'inline' into the statement and
        not pre-executed.  This means that their values will not be available
        in the dictionary returned from
        :meth:`_engine.CursorResult.last_updated_params`.

        .. versionchanged:: 1.4 the :paramref:`_expression.update.inline`
           parameter
           is now superseded by the :meth:`_expression.Update.inline` method.

        Trirs rWrjz
Update.inline3s�� ����rZc��yrSrT)rm�
_Update__ent0s  rWr)zUpdate.returningLrsrZc��yrSrT)rmr��
_Update__ent1s   rWr)zUpdate.returningQ���03rZc��yrSrT)rmr�r��
_Update__ent2s    rWr)zUpdate.returningV���58rZc��yrSrT)rmr�r�r��
_Update__ent3s     rWr)zUpdate.returning[���:=rZc��yrSrT)rmr�r�r�r��
_Update__ent4s      rWr)zUpdate.returningd���?BrZc��yrSrT)rmr�r�r�r�r��
_Update__ent5s       rWr)zUpdate.returningn�	��DGrZc��yrSrT)rmr�r�r�r�r�r��
_Update__ent6s        rWr)zUpdate.returningy�	��ILrZc	��yrSrT)	rmr�r�r�r�r�r�r��
_Update__ent7s	         rWr)zUpdate.returning����rZc��yrSrT�rmr �_Update__kws   rWr)zUpdate.returning����$'rZc��yrSrTr�s   rWr)zUpdate.returning����#&rZr_)rZzTuple[_DMLColumnArgument, Any]r�r:r�)r�r�r�zReturningUpdate[Tuple[_T0]])r�r�r�r�r�z ReturningUpdate[Tuple[_T0, _T1]])r�r�r�r�r�r�r�z%ReturningUpdate[Tuple[_T0, _T1, _T2]])
r�r�r�r�r�r�r�r�r�z*ReturningUpdate[Tuple[_T0, _T1, _T2, _T3]])r�r�r�r�r�r�r�r�r�r�r�z/ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4]])r�r�r�r�r�r�r�r�r�r�r�r�r�z4ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]])r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�z9ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]])r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�z>ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]])r r?r�rr�zReturningUpdate[Any])r�r�r�rCr��	is_updater7r�r�r��dp_dml_ordered_valuesr�r�r1r�r$r�r%r�r0r�r�rprr�rjrrr)r�r�s@rWr�r��s������N��I��'�8�8�9�
� 1� H� H�I�
�)�4�4�5�
� 1� G� G�H�
�)�7�7�8�
�,�C�C�D�
�(�;�;�<�
�!2�!=�!=�>�*�!�8�8�
�
	
��
6�
6�	7��
:�
:�	;� �
3�
3�!	4�"�
-�
-�#	.��* �� �� �D����$�
�	.�$�	.�
(�	.�
�	.�
�	3�$�	3�.8�	3�
-�	3�
�	3�
�	8�$�	8�.8�	8�BL�	8�
2�	8�
�	8�
�	=��	=��	=��		=�
�	=�8�
	=�
�	=�
�	B��	B��	B��		B�
�	B��
	B�=�	B�
�	B�
�	G��	G��	G��		G�
�	G��
	G��	G�B�	G�
�	G�
�		L��		L��		L��			L�
�		L��
		L��		L��		L�G�		L�
�		L�
�	��	��	��		�
�	��
	��	��	��	�
�	�
�	� 
�	'�4�	'�>A�	'�
!�	'�
�	'�	'�4�	'�>A�	'�
!�	'�krZr�c��eZdZdZy)�ReturningUpdatez�Typing-only class that establishes a generic type form of
    :class:`.Update` which tracks returned column types.

    This datatype is delivered when calling the
    :meth:`.Update.returning` method.

    .. versionadded:: 2.0

    Nr�rTrZrWr�r��r�rZr�c�l�eZdZdZdZdZdejfdejfdejfdejfge
jzejzejzej"zZdd�Zer�e				dd	��Ze						dd
��Ze								dd��Ze										dd��Ze												dd
��Ze														dd��Ze																dd��Ze																		dd��Ze						dd��Z						dd�Zyy)r�z�Represent a DELETE construct.

    The :class:`_expression.Delete` object is created using the
    :func:`_expression.delete()` function.

    r�Trsr�r�r�c�Z�tjtj||��|_yrOrRrSs  rWrpzDelete.__init__�rTrZc��yrSrT)rm�
_Delete__ent0s  rWr)zDelete.returning�rsrZc��yrSrT)rmr��
_Delete__ent1s   rWr)zDelete.returning�r�rZc��yrSrT)rmr�r��
_Delete__ent2s    rWr)zDelete.returning�r�rZc��yrSrT)rmr�r�r��
_Delete__ent3s     rWr)zDelete.returning�r�rZc��yrSrT)rmr�r�r�r��
_Delete__ent4s      rWr)zDelete.returning�r�rZc��yrSrT)rmr�r�r�r�r��
_Delete__ent5s       rWr)zDelete.returning�r�rZc��yrSrT)rmr�r�r�r�r�r��
_Delete__ent6s        rWr)zDelete.returning�r�rZc	��yrSrT)	rmr�r�r�r�r�r�r��
_Delete__ent7s	         rWr)zDelete.returning	r�rZc��yrSrT�rmr �_Delete__kws   rWr)zDelete.returningr�rZc��yrSrTr�s   rWr)zDelete.returningr�rZNr_)r�r�r�zReturningDelete[Tuple[_T0]])r�r�r�r�r�z ReturningDelete[Tuple[_T0, _T1]])r�r�r�r�r�r�r�z%ReturningDelete[Tuple[_T0, _T1, _T2]])
r�r�r�r�r�r�r�r�r�z*ReturningDelete[Tuple[_T0, _T1, _T2, _T3]])r�r�r�r�r�r�r�r�r�r�r�z/ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4]])r�r�r�r�r�r�r�r�r�r�r�r�r�z4ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]])r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�z9ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]])r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�z>ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]])r r?r�rr�zReturningDelete[Any])r�r�r�rCr��	is_deleter7r�r�r�r1r�r$r�r%r�r0r�r�rprrr)rTrZrWr�r��sM����N��I��'�8�8�9�
� 1� H� H�I�
�,�C�C�D�
�(�;�;�<�		
��
6�
6�
	7��
:�
:�	;��
3�
3�	4��
-�
-�		.��
�
�
�	.�$�	.�
(�	.�
�	.�
�	3�$�	3�.8�	3�
-�	3�
�	3�
�	8�$�	8�.8�	8�BL�	8�
2�	8�
�	8�
�	=��	=��	=��		=�
�	=�8�
	=�
�	=�
�	B��	B��	B��		B�
�	B��
	B�=�	B�
�	B�
�	G��	G��	G��		G�
�	G��
	G��	G�B�	G�
�	G�
�		L��		L��		L��			L�
�		L��
		L��		L��		L�G�		L�
�		L�
�	��	��	��		�
�	��
	��	��	��	�
�	�
�	� 
�	'�4�	'�>A�	'�
!�	'�
�	'�	'�4�	'�>A�	'�
!�	'�krZr�c��eZdZdZy)�ReturningDeletez�Typing-only class that establishes a generic type form of
    :class:`.Delete` which tracks returned column types.

    This datatype is delivered when calling the
    :meth:`.Delete.returning` method.

    .. versionadded:: 2.0

    Nr�rTrZrWr�r�$r�rZr�)rVrQr�zTypeGuard[UpdateDMLState])rVrQr�zTypeGuard[DeleteDMLState])rVrQr�zTypeGuard[InsertDMLState])urC�
__future__r�collections.abc�abcr��operator�typingrrrrrr	r
rrr
rrrrrr�rrrr��_typingrrrr�baserrrrr r!r"r#r$r%r&r'�elementsr(r)r*r+r,r6r-r.r/r0r1r2r3r4r5�sqltypesr6�visitorsr7r9�util.typingr:r;r<r=r>r?r@rArBrCrDrErFrGrHrI�_TCCArJrnrKrLrMrNrOrPrXr\r^�
attrgetterr_rB�_DMLColumnElementr�rQ�
plugin_forr�r�r��DMLRolerhr�r�r�r�r�r�r�r�rTrZrW�<module>rs����
#�)�������!�������� �������#�&�)�'�$���#�"������!�'�#�"�#���-�"��#��(�#�(��'����#��2�/�+�-�*���������<�.�%�,�1�+�"�&�A�A�A�#�x�"�"�:�.�H�"�x�"�"�:�.�H�"�x�"�"�:�.�H�
�T�����#�|�C�0�0�1����e�T�1�2��R
�|�R
�j�����H�-�C@�X�C@�.�C@�L�����H�-�%�X�%�.�%�P�����H�-�
 �X�
 �.�
 �G	�	�M�M�
�������G	�TS��S�ll'�Z�l'�^	�f�.�s�3�	�I
�I
�Xq'�\�:�q'�h	�f�.�s�3�	�u'�\�:�u'�p	�f�.�s�3�	rZ

ZeroDay Forums Mini