� k\�gb� ���dZddlmZddlmZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd 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]d|dU�Z^d}dW�Z_d~dY�Z`n0ejadZ��Z^ejad[��Z_ejad\��Z`ed]e�^��Zbeece2efZdee=e6e;fZeGd_�dRe*��Zfe*jgd`da��Gdb�dcef����Zhe*jgd`dd��Gde�dfef����Zie*jgd`dg��Gdh�dief����ZjGdj�dkejke9e.e+e:e-e7e1� � ZlGdl�dmel��ZmGdn�doem��ZnGdp�dqene>e��ZoGdr�ds��ZpGdt�duepem��ZqGdv�dweqe>e��ZrGdx�dyepel��ZsGdz�d{eqe>e��ZtdS)zd 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�dml�DMLState�return�TypeGuard[UpdateDMLState]c��dS�N��rSs �b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sqlalchemy/sql/dml.py�isupdater\`������TypeGuard[DeleteDMLState]c��dSrXrYrZs r[�isdeleterabr]r^�TypeGuard[InsertDMLState]c��dSrXrYrZs r[�isinsertrddr]r^r\rard�_T)�boundc�4�eZdZUdZdZded<dZded<dZded<dZd ed <d ed <dZ d Z d Z d Z ded<d3d�Z ed4d���Zed5d���Zed6d���Zer ed7d���Zed8d"���Zed9d(���Zd:d+�Zd;d.�Zd;d/�Zd<d1�Zd=d2�ZdS)>rTTNz0Optional[MutableMapping[_DMLColumnElement, Any]]�_dict_parametersz6Optional[List[MutableMapping[_DMLColumnElement, Any]]]�_multi_parameters�-Optional[List[Tuple[_DMLColumnElement, Any]]]�_ordered_valuesz!Optional[List[_DMLColumnElement]]�_parameter_orderingr1�_primary_tableF� UpdateBase� statement�compilerrM�kwrc ��t���rX��NotImplementedError)�selfrorprqs r[�__init__zDMLState.__init__�s��"�#�#�#r^rU�Dict[str, Any]c�V�t|j��r |jjnd|jd�S)N)�name�table)rrzry��clsros r[�get_entity_descriptionzDMLState.get_entity_description�s7�� (� ��8�8�� ��$�$���_�  � � r^�List[Dict[str, Any]]c�$�d�|jD��S)Nc�.�g|]}|j|j|d���S))ry�type�expr)�keyr���.0�cs r[� <listcomp>z>DMLState.get_returning_column_descriptions.<locals>.<listcomp>�s>�� � � � � ����� � � � � r^)�_all_selected_columnsr{s r[�!get_returning_column_descriptionsz*DMLState.get_returning_column_descriptions�s(�� � � �4�  � � � r^�_DMLTableElementc��|jjSrX)rorz�rus r[� dml_tablezDMLState.dml_table�s ���~�#�#r^r&�Type[DMLState]c��dSrXrYr{s r[�get_plugin_classzDMLState.get_plugin_class�s��LO�Cr^�multi_kv_iterator�'Iterable[Dict[_DMLColumnArgument, Any]]�"List[Dict[_DMLColumnElement, Any]]c��d�|D��S)Nc�J�g|] }d�|���D����!S)c�T�i|]%\}}tjtj|��|��&SrY�r�expectr� DMLColumnRole)r��k�vs r[� <dictcomp>z@DMLState._get_multi_crud_kv_pairs.<locals>.<listcomp>.<dictcomp>�s>�� � � ��A�q�� ��!4�a�8�8�!� � � r^)�items)r��mappings r[r�z5DMLState._get_multi_crud_kv_pairs.<locals>.<listcomp>�sI�� � � � �  � �#�M�M�O�O� � � � � � r^rY)r|ror�s r[�_get_multi_crud_kv_pairsz!DMLState._get_multi_crud_kv_pairs�s%��  � � -�  � � � r^� kv_iterator�(Iterable[Tuple[_DMLColumnArgument, Any]]�needs_to_be_cacheable�bool�#List[Tuple[_DMLColumnElement, Any]]c� ���fd�|D��S)Nc ���g|]V\}}tjtj|���s|n-tjtj|t ��d���f��WS)T)�type_�is_crud)rr�rr��ExpressionElementRoler8)r�r�r�r�s �r[r�z/DMLState._get_crud_kv_pairs.<locals>.<listcomp>�sz��� � � ���1�� ��!4�a�8�8�1��A�A�"�)��3��&�j�j� $� ��� � � � r^rY)r|ror�r�s `r[�_get_crud_kv_pairszDMLState._get_crud_kv_pairs�s0��� � � � �$� � � � r^� DMLWhereBase�#Tuple[FromClause, List[FromClause]]c���g}ttj|j����}|d}|h}|j}|jr)|t |j�����z }|D]]}t|��D]K}|� |j ��s|� |��|� |j ���L�^|� |dd���||fS)Nrr)�list�sql_util�tables_from_leftmostrz�_where_criteriarh�tuple�valuesr� intersection� _cloned_set�append�update�extend) ruro�froms� all_tables� primary_table�seen�consider�crit�items r[�_make_extra_fromszDMLState._make_extra_froms�s���#%���(�7� ��H�H�I�I� �"�1� � �����,�� � � >� ��d�3�:�:�<�<�=�=� =�H�� .� .�D�%�d�+�+� .� .���(�(��)9�:�:�'��L�L��&�&�&�� � �D�,�-�-�-�-� .� � � �Z����^�$�$�$��e�#�#r^� ValuesBase�Nonec�>�|jr|j|_d|_dSdS�NF)�_no_parameters�_valuesrh�ruros r[�_process_valueszDMLState._process_values�s0�� � � (�$-�$5�D� !�"'�D� � � � (� (r^c�x�|j�J�d�|jD��}|jrd|_||_dSJd���)Nc�,�i|]}|t����SrYr-�r�rys r[r�z3DMLState._process_select_values.<locals>.<dictcomp>�s+��> �> �> �!�D�$�&�&�> �> �> r^Fz%This statement already has parameters)� _select_namesr�rh�ruro� parameterss r[�_process_select_valueszDMLState._process_select_values�sg���&�2�2�2�> �> �%.�%<�> �> �> � � � � B�"'�D� �$.�D� !� !� !� B�A� A� A�5r^r c�^�tjd|j���z���)Nz6%s construct does not support multiple parameter sets.)r;�InvalidRequestError�__visit_name__�upperr�s r[�_no_multi_values_supportedz#DMLState._no_multi_values_supported�s4���%� '�)2�)A�)G�)G�)I�)I� J� � � r^c�*�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.)r;r�r�s r[�_cant_mix_formats_errorz DMLState._cant_mix_formats_error�s���%� � � � r^)rornrprMrqr)rornrUrw)rornrUr~�rUr�)ror&rUr�)rornr�r�rUr�)rornr�r�r�r�rUr�)ror�rUr��ror�rUr�)ror�rUr )rUr )�__name__� __module__� __qualname__r�rh�__annotations__rirkrl�_supports_implicit_returningr\rardrv� classmethodr}r��propertyr�rr�r�r�r�r�r�r�r�rYr^r[rTrTrs���������N�IM��M�M�M�M� �� � � � �FJ�O�I�I�I�I�=A��A�A�A�A�����#'� ��H��H��H�����$�$�$�$� � � � ��[� ��  �  �  ��[�  ��$�$�$��X�$��P� �O�O�O� ��O��  �  �  ��[�  �� � � ��[� �.$�$�$�$�,(�(�(�(� B� B� B� B� � � � �  � � � � � r^�default�insertc�X�eZdZdZdZdZ ddd �Zejdd���Z dd�Z dd�Z dS)�InsertDMLStateTFro�InsertrprM�disable_implicit_returningr�rqrc ���||_|j|_|rd|_d|_|jr|�|��|j�|�|��|j r|� |��dSdS)NFT) rorzrmr�rdr�r�r�r�� _multi_values�_process_multi_values)rurorpr�rqs r[rvzInsertDMLState.__init__s���#���'�o��� %� 6�05�D� -��� � � "� 3� � '� '� � 2� 2� 2� � � (� � � �� +� +� +� � "� 2� � &� &�y� 1� 1� 1� 1� 1� 2� 2r^rU� List[str]c�(�d�|jpdD��S)Nc�P�g|]#}tjtj|d�����$S�T)�as_keyr�)r��cols r[r�z3InsertDMLState._insert_col_keys.<locals>.<listcomp>'s=�� � � �� � �U�0�#�d� C� C� C� � � r^rY)rhr�s r[�_insert_col_keyszInsertDMLState._insert_col_keys$s+�� � ��,�2�� � � � r^r�r�c��|jrd|_|j|_d|_dS|jr|���dSdSr�)r��_has_multi_parametersr�rhr�r�s r[r�zInsertDMLState._process_values,s[�� � � +�).�D� &�$-�$5�D� !�"'�D� � � � � '� +� � (� (� *� *� *� *� *� +� +r^c����jD]~}�fd�|D��}|jr(d|_d|_||_|jd|_�?|js|����[|jsJ�|j�|���dS)Nc���g|]B}t|tj��r$d�t�jj|��D��n|��CS)c�$�i|] \}}|j|��SrY�r��r�r��values r[r�zCInsertDMLState._process_multi_values.<locals>.<listcomp>.<dictcomp>8s0�����$�A�u���u���r^)� isinstance�collections_abcr �ziprzr�)r�� parameter_setros �r[r�z8InsertDMLState._process_multi_values.<locals>.<listcomp>6sx��� N� N� N�"�"�-��1I�J�J� '���(+�I�O�,=�}�(M�(M����� '� N� N� Nr^FTr)r�r�r�rirhr�r�)ruror��multi_parameterss ` r[r�z$InsertDMLState._process_multi_values4s����#�1� @� @�J� N� N� N� N�&0� N� N� N� ��"� @�&+��#�-1��*�)9��&�(,�(>�q�(A��%�%��/� @��,�,�.�.�.�.��-�-�-�-��&�-�-�.>�?�?�?�?�- @� @r^N�F)ror�rprMr�r�rqr)rUr�r�) r�r�r�rd�include_table_with_column_exprsr�rvr�memoized_propertyr�r�r�rYr^r[r�r�s��������H�&+�#�!�� ,1� 2�2�2�2�2�* �� � � ��� �+�+�+�+�@�@�@�@�@�@r^r�r�c�&�eZdZdZdZdd �Zdd �ZdS)�UpdateDMLStateTFro�UpdaterprMrqrc �b�||_d|_|j�|�|��n9|j�|�|��n|jr|�|��|�|��\}}||_ ||_ |x|_ }t|o|j ��|_dS�NT)ror\rk�_process_ordered_valuesr�r�r�r�r�rm� _extra_froms� is_multitabler��'render_table_with_column_in_update_fromr�)rurorprq�t�ef�mts r[rvzUpdateDMLState.__init__Ts���"����� � � $� 0� � (� (�� 3� 3� 3� 3� � � *� � � �� +� +� +� +� � $� 7� � +� +�I� 6� 6� 6��&�&�y�1�1���2�������"$�$���R�/3� � C�8�C�0 �0 ��,�,�,r^r�rUr�c��|j}|jr9d|_|�J�t|��|_||_d�|D��|_dSt jd���)NFc��g|]\}}|��SrYrY)r�r�r�s r[r�z:UpdateDMLState._process_ordered_values.<locals>.<listcomp>os��'I�'I�'I� ��U��'I�'I�'Ir^zQCan only invoke ordered_values() once, and not mixed with any other values() call)rkr��dictrhrlr;r�r�s r[rz&UpdateDMLState._process_ordered_valuesgsw���.� � � � �"'�D� ��)�)�)�$(��$4�$4�D� !�#-�D� �'I�'I�j�'I�'I�'I�D� $� $� $��)�/��� r^N)rorrprMrqrr�)r�r�r�r\r�rvrrYr^r[rrNsG�������H�&+�#� � � � �& � � � � � r^r�deletec��eZdZdZd d�Zd S) �DeleteDMLStateTro�DeleterprMrqrc �|�||_d|_|�|��\}}||_||_||_dSr)rorar�rmrr)rurorprqr r s r[rvzDeleteDMLState.__init__{sE��"����� ��&�&�y�1�1���2�����������r^N)rorrprMrqr)r�r�r�rarvrYr^r[rrws-�������H� � � � � � r^rc��eZdZUdZdZejZded<dZ e j Z ded<ded <dZ d Zd ed <d Zd ed <dZded<dZdEd�ZdFd!�ZedGd$���Zed dd%�dHd,���Zedd-�dId0���Z dJdKd5�ZejdLd7���ZejdMd9���Ze dNdOd@���ZedPdB���ZedQdD���Zd S)RrnzDForm the base for ``INSERT``, ``UPDATE``, and ``DELETE`` statements.� update_basez5util.immutabledict[Tuple[_DMLTableElement, str], str]�_hintsFr5� _label_styler�rzNz+Optional[Tuple[_ColumnsClauseElement, ...]]�_return_defaults_columns�_supplemental_returningrYz!Tuple[_ColumnsClauseElement, ...]� _returningT� fromclauser1�columns�.ColumnCollection[str, KeyedColumnElement[Any]]� primary_keyr#� foreign_keys�Set[KeyedColumnElement[Any]]rUr�c�\����|����fd�|jD����dS)Nc3�f�K�|]+}t|���|�������V��,dS))rrN)r� _make_proxy)r�r�rrrs ���r[� <genexpr>zAUpdateBase._generate_fromclause_column_proxies.<locals>.<genexpr>�sa�����( �( �� ��%�%� ( � �O�O�� �,� � � �( �( �( �( �( �( r^)�_populate_separate_keysr�)rurrrrs ` ``r[�#_generate_fromclause_column_proxiesz.UpdateBase._generate_fromclause_column_proxies�s^����� �'�'�( �( �( �( �( �( ��1� ( �( �( � � � � � r^�argrrqr c� �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).rs)rur'rqs r[�paramszUpdateBase.params�s��"� *� � � r^�optr<c �0�|�|��|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)rur*s r[�with_dialect_optionszUpdateBase.with_dialect_options�s�� �%�%�c�*�*�*�� r^)�supplemental_cols�sort_by_parameter_order�colsr@r.�&Optional[Iterable[_DMLColumnArgument]]r/r�c�H�|jrZ|jrK|rIttj|j���d�|D������|_n&d|_ntd�|D����|_d|_|r"|jstjd���d|_ |rud�|D��}|j �'ttj |����|_ n;ttj |j t|��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�TK�|]#}tjtj|��V��$dSrX�rr�r�ColumnsClauseRoler�s r[r$z-UpdateBase.return_defaults.<locals>.<genexpr>�sN����I�I��"�(��)@�!�D�D�I�I�I�I�I�Ir^rYc3�TK�|]#}tjtj|��V��$dSrXr4r�s r[r$z-UpdateBase.return_defaults.<locals>.<genexpr>�sC����2�2�AB� � ��!8�!�<�<�2�2�2�2�2�2r^Tz]The 'sort_by_parameter_order' argument to return_defaults() only applies to INSERT statementsc3�TK�|]#}tjtj|��V��$dSrXr4r�s r[r$z-UpdateBase.return_defaults.<locals>.<genexpr>�sF����$�$��� ��!8�!�<�<�$�$�$�$�$�$r^) �_return_defaultsrr�r� OrderedSet�union� is_insertr;� ArgumentError�_sort_by_parameter_orderr� unique_list)rur.r/r0�supplemental_col_tups r[�return_defaultszUpdateBase.return_defaults�s���n � � ��,� 3�� 3�05��O�D�$A�B�B�H�H�I�I�!%�I�I�I���1�1��-�-�13��-�-�,1�2�2�FJ�2�2�2�-�-�D� )�!%��� "� 1��>� ��'�J����-1�D� )� � �$�$�*�$�$�$� � �+�3�/4��$�%9�:�:�0�0��,�,�05��$��4�� 4�5�5�6���0�0��,�� r^�r/�_ColumnsClauseArgument[Any]�_UpdateBase__kwc���|rtd|���|jrtjd���|xjt d�|D����z c_|r"|jstjd���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�TK�|]#}tjtj|��V��$dSrXr4r�s r[r$z'UpdateBase.returning.<locals>.<genexpr>sC����! �! �=>�I� �U�4�a� 8� 8�! �! �! �! �! �! r^zWThe 'sort_by_parameter_order' argument to returning() only applies to INSERT statementsT) rr8r;r�rr�r;r<r=)rur/r0rCs r[� returningzUpdateBase.returning�s���~ � A� �!9�4�@�@� @� � � ��)�K��� � ���5�! �! �BF�! �! �! � � � ��� #� 1��>� ��'�8����-1�D� )�� r^�column�KeyedColumnElement[Any]�require_embedded�Optional[ColumnElement[Any]]c�:�|j�||���S)N)rI)�exported_columns�corresponding_column)rurGrIs r[rMzUpdateBase.corresponding_column+s*���$�9�9� �%5�:� � � r^rPc�>�d�t|j��D��S)Nc��g|]}|��SrYrYr�s r[r�z4UpdateBase._all_selected_columns.<locals>.<listcomp>4s��>�>�>�a��>�>�>r^)r!rr�s r[r�z UpdateBase._all_selected_columns2s!��>�>�,�T�_�=�=�>�>�>�>r^�;ReadOnlyColumnCollection[Optional[str], ColumnElement[Any]]c�b�td�|jD�������S)zxReturn the RETURNING columns as a column collection for this statement. .. versionadded:: 1.4 c3�FK�|]}t|���|j|fV��dSrX)rr�r�s r[r$z.UpdateBase.exported_columns.<locals>.<genexpr>@sJ���� � �� ��#�#� � �U�A�J� � � � � � r^)r"r�� as_readonlyr�s r[rLzUpdateBase.exported_columns6s@�� � � ��/� � � � � � �+�-�-�  r^�*�text�str� selectable�Optional[_DMLTableArgument]� dialect_namec��|�|j}ntjtj|��}|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. )rzrr�r� DMLTableRolerr:)rurUrWrYs r[� with_hintzUpdateBase.with_hintFsO��H � ���J�J�"�)�%�*<�j�I�I�J��k�'�'�*�l�)C�T�(J�K�K�� �� r^rwc�V�t�|��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 )rTr�r}�ru�meths r[�entity_descriptionzUpdateBase.entity_descriptionqs)��B�(�(��.�.�E���t�D�z�z�r^r~c�V�t�|��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 )rTr�r�r^s r[�returning_column_descriptionsz(UpdateBase.returning_column_descriptions�s3��T�(�(� � � � +� ��t�D�z�z�r^) rr1rrrr#rr rUr�)r'rrqrrUr )r*rrUr<)r0r@r.r1r/r�rUr<)r0rBr/r�rCrrUrnr�)rGrHrIr�rUrJ)rUrP)rUrP)NrT)rUrVrWrXrYrVrUr<)rUrw)rUr~) r�r�r��__doc__r�r� EMPTY_DICTrr��named_with_columnr5�LABEL_STYLE_DISAMBIGUATE_ONLYrr8rrr�is_dmlr&r)r r-r@rFrM�ro_memoized_propertyr�rLr\r�r`rbrYr^r[rnrn�sY�������O�N�"�N� �� ������� �6������������ ������LP��O�O�O�O�46�J�6�6�6�6� �F�  �  �  �  �  �  �  �  �� � � ��[� ��EI�(-� d�d�d�d�d��[�d�L�).�n�n�n�n�n��[�n�bIN� � � � � � ��?�?�?���?� �� � � ��� ��37�� (�(�(�(��[�(�T�!�!�!��X�!�F�,�,�,��X�,�,�,r^rnc���eZdZUdZdZdZdZded< dZded< dZ d ed <d Z d ed <dZ ded<dZ ded<dZ ded<d"d�Zeeddddd����d#d!�����ZdS)$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�rYzRTuple[Union[Sequence[Dict[_DMLColumnElement, Any]], Sequence[Sequence[Any]]], ...]r�rjrkzOptional[List[str]]r�r��_inlinerzrBc�R�tjtj||���|_dS�N��apply_propagate_attrs�rr�rr[rz�rurzs r[rvzValuesBase.__init__��)���%� � ��T� � � �� � � r^z,This construct already inserts from a SELECT�1This statement already has ordered values present)r�rk)�msgs�args�/Union[_DMLColumnKeyMapping[Any], Sequence[Any]]�kwargsrrUr<c���|�r2|d}|rtjd���t|��dkrtjd���t|tj��r�|rWt|dt ��r<t�|��j }|xj |||��fz c_ |S|r5t|dttf��r|xj |fz c_ |Strt|t��sJ�d�t|jj|��D��}n&t%d|��}|rtjd���t�|��j}t |||���d����}|jr |j�|��|_nt/j|��|_|S)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.c�$�i|] \}}|j|��SrYr�r�s r[r�z%ValuesBase.values.<locals>.<dictcomp>�s ��K�K�K���5�q�u�e�K�K�Kr^zDict[_DMLColumnArgument, Any]T)r;r<�lenr�r�r rrTr�r�r�r�r�rr�r�rzr�rr�r�r�r:r� immutabledict)rurwryr'�multi_kv_generator� kv_generator� coerced_args r[r�zValuesBase.values�s��h �/ � �q�'�C�� L��'�%�����T���Q����'�D���� �C��!9�:�:� L�� �:�c�!�f�d�3�3� �)1�)B�)B��*�*�.�'��&�&�+=�+=�d�C�+H�+H�*J�J�&�&��K�� �:�c�!�f�t�U�m�<�<� ��&�&�3�&�0�&�&��K� �4�&�d�F�3�3�3�3�3�L�K�C�� � �c�4J�4J�K�K�K��� �6��?�?�C�� ��'�D���� �0�0��6�6�I� ��<�<��c�i�i�k�k�4�@�@�A�A� � �<� ;��<�-�-�k�:�:�D�L�L��-�k�:�:�D�L�� r^�rzrB)rwrxryrrUr<)r�r�r�rcr��_supports_multi_parametersrkr�rlr�r�rkr�rmrvr rr�rYr^r[r�r��s3�������%�%�#�N�!&��$(�F�(�(�(�(�4�37��7�7�7�7�)�EI�G�H�H�H�H� � � � � � �FJ�O�I�I�I�I�)-�M�-�-�-�-��G����� � � � � �����K� � � ����g�g�g����[�g�g�gr^r�c ���eZdZUdZdZdZdZdZdZde d<dZ de d <d e j fd e j fd e jfd e jfd e jfde j fde j fde jfde jfde j fde jfde j fg ejzejzejzejzZdG�fd� ZedHd���Ze dIdJd���Ze r�e!dd�dKd#���Z"e!dd�dLd'���Z"e!dd�dMd+���Z"e!dd�dNd/���Z"e!dd�dOd3���Z"e!dd�dPd7���Z"e!dd�dQd;���Z"e!dd�dRd?���Z"e!dd�dSdE���Z"dd�dSdF�Z"�xZ#S�xZ#S)Tr�z�Represent an INSERT construct. The :class:`_expression.Insert` object is created using the :func:`_expression.insert()` function. r�TNFr�r=r6rzrmr�r�r�rkrlrrr8rrBc�J��t���|��dSrX��superrv�rurz� __class__s �r[rvzInsert.__init__��!��� ����������r^rUr<c��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�rmr�s r[�inlinez Insert.inline�s��$�� �� r^�names�Sequence[_DMLColumnArgument]rR�include_defaultsc���|jrtjd���d�|D��|_d|_||_t jtj |��|_ |S)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 expressionsc�P�g|]#}tjtj|d�����$Sr�r�r�s r[r�z&Insert.from_select.<locals>.<listcomp>s=�� � � �� � �U�0�$�t� D� D� D� � � r^T) r�r;r�r�rm�#include_insert_from_select_defaultsrr�r� DMLSelectRolerk)rur�rkr�s r[� from_selectzInsert.from_select�su��R �<� ��)�B��� � � �� � � ����� �3C��0��&�u�':�F�C�C�� �� r^rA� _Insert__ent0� _TCCA[_T0]r/�ReturningInsert[Tuple[_T0]]c��dSrXrY)rur�r/s r[rFzInsert.returning� ��+.�#r^� _Insert__ent1� _TCCA[_T1]� ReturningInsert[Tuple[_T0, _T1]]c��dSrXrY)rur�r�r/s r[rFzInsert.returning"s ��03�sr^� _Insert__ent2� _TCCA[_T2]�%ReturningInsert[Tuple[_T0, _T1, _T2]]c��dSrXrY)rur�r�r�r/s r[rFzInsert.returning+s ��58�Cr^� _Insert__ent3� _TCCA[_T3]�*ReturningInsert[Tuple[_T0, _T1, _T2, _T3]]c��dSrXrY)rur�r�r�r�r/s r[rFzInsert.returning5s ��:=�r^� _Insert__ent4� _TCCA[_T4]�/ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4]]c��dSrXrY)rur�r�r�r�r�r/s r[rFzInsert.returning@s ��?B�cr^� _Insert__ent5� _TCCA[_T5]�4ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]]c��dSrXrY)rur�r�r�r�r�r�r/s r[rFzInsert.returningLs ��DG�3r^� _Insert__ent6� _TCCA[_T6]�9ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]]c��dSrXrY) rur�r�r�r�r�r�r�r/s r[rFzInsert.returningYs ��IL�r^� _Insert__ent7� _TCCA[_T7]�>ReturningInsert[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]]c ��dSrXrY) rur�r�r�r�r�r�r�r�r/s r[rFzInsert.returninggs �� �3r^r0rB� _Insert__kwr�ReturningInsert[Any]c��dSrXrY�rur/r0r�s r[rFzInsert.returningzs �� $'�3r^c��dSrXrYr�s r[rFzInsert.returning�s �� $'�3r^r��rUr<)T)r�r�rkrRr�r�rUr<)r�r�r/r�rUr�)r�r�r�r�r/r�rUr�) r�r�r�r�r�r�r/r�rUr�) r�r�r�r�r�r�r�r�r/r�rUr�)r�r�r�r�r�r�r�r�r�r�r/r�rUr�)r�r�r�r�r�r�r�r�r�r�r�r�r/r�rUr�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r/r�rUr�)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r/r�rUr�)r0rBr/r�r�rrUr�)$r�r�r�rcr�r�rkr�r=r�r;r9�dp_clauseelement� dp_boolean�dp_string_list� dp_dml_values�dp_dml_multi_values�dp_clauseelement_tuple�dp_table_hint_listr3� _has_prefixes_traverse_internalsr%�"_dialect_kwargs_traverse_internalsr&�_executable_traverse_internalsr2�_has_ctes_traverse_internals�_traverse_internalsrvr r�r�rr rF� __classcell__�r�s@r[r�r��s������������N�!%�� �F�*/�'�%*��*�*�*�*��I������'�8� 9� �)�4� 5� �/�>� ?� �)�7� 8� �/�C� D� �(�9� :� "�$5�$F� G� �,�C� D� �(�;� <� �!2�!=� >�*�!�8� �(�):�)E� F� �" � 6�# 7�$ � :�% ;�& � 3�' 4�( � -�) .��0 � � � � � ������[��(� "&� 4�4�4�4��[�4�l�p'� �IN� .� .� .� .� .� �� .� � -2�  3� 3� 3� 3� 3� �� 3� �-2�  8� 8� 8� 8� 8� �� 8� �-2� =� =� =� =� =� �� =� �-2� B� B� B� B� B� �� B� �-2� G� G� G� G� G� �� G� �-2� L� L� L� L� L� �� L� �-2� � � � � � �� �$ �-2� '� '� '� '� '� �� '�-2� '� '� '� '� '� '� '� '� '� '�Wp'�p'�p'�p'r^r�c��eZdZdZdS)�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�rcrYr^r[r�r������������r^r�c�p�eZdZUded<dZded<edd ���Zdd �Zdd�Zdd�Z e dd���Z dS)r�r�rzrYzTuple[ColumnElement[Any], ...]r�� whereclause�_ColumnExpressionArgument[bool]rUr<c�t�|D]4}tjtj||���}|xj|fz c_�5|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�)rur�� criterion�where_criterias r[�wherezDMLWhereBase.where�sU��,%� 6� 6�I�1:�1A��%�y��2�2�2�N� � � �^�$5� 5� � � �� r^�criteria� roles.ExpressionElementRole[Any]c��|j|�S)zbA synonym for the :meth:`_dml.DMLWhereBase.where` method. .. versionadded:: 1.4 )r�)rur�s r[�filterzDMLWhereBase.filter�s���t�z�8�$�$r^c��|jSrX)rzr�s r[�_filter_by_zerozDMLWhereBase._filter_by_zero�s ���z�r^ryrc ���|�����fd�|���D��}|j|�S)zWapply the given filtering criterion as a WHERE clause to this select. c�>��g|]\}}t�|��|k��SrYr)r�r�r�� from_entitys �r[r�z*DMLWhereBase.filter_by.<locals>.<listcomp>�s<��� � � ���U� "�+�s� 3� 3�u� <� � � r^)r�r�r�)rury�clausesr�s @r[� filter_byzDMLWhereBase.filter_by�sW��� �*�*�,�,� � � � � �$�l�l�n�n� � � ���t�{�G�$�$r^rJc�4�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�r�s r[r�zDMLWhereBase.whereclause�s��!�;� � � � � r^N)r�r�rUr<)r�r�rUr<r�)ryrrUr<)rUrJ) r�r�r�r�r�r r�r�r�r�r�r�rYr^r[r�r��s������������68�O�8�8�8�8������[��8%�%�%�%����� %� %� %� %�� � � ��X� � � r^r�c ���eZdZdZdZdZdejfdejfdej fdej fdej fd ejfd ej fd ej fd ejfg e jzejzejzejzZd<�fd� Zed=d���Zed>d���Zerted?d���Zed@d���ZedAd ���ZedBd$���ZedCd(���ZedDd,���ZedEd0���ZedFd4���ZedGd:���ZdGd;�Z�xZS�xZS)Hrz�Represent an Update construct. The :class:`_expression.Update` object is created using the :func:`_expression.update()` function. r�Trzr�rmrkr�rrr8rrBc�J��t���|��dSrXr�r�s �r[rvzUpdate.__init__r�r^rw�Tuple[_DMLColumnArgument, Any]rUr<c���|jrtjd���|jrtjd���t�|��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�r;r<rkrTr�r�)rurwrs r[�ordered_valueszUpdate.ordered_valuess~��, �<� ��#�;��� �� !� ��#�C��� � �0�0��6�6�I� �+�|�D�$��=�=���� r^c��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. Tr�r�s r[r�z Update.inline)s�� �� �� r^� _Update__ent0r��ReturningUpdate[Tuple[_T0]]c��dSrXrY)rur�s r[rFzUpdate.returningBr�r^� _Update__ent1r�� ReturningUpdate[Tuple[_T0, _T1]]c��dSrXrY)rur�r�s r[rFzUpdate.returningG� ��03�sr^� _Update__ent2r��%ReturningUpdate[Tuple[_T0, _T1, _T2]]c��dSrXrY)rur�r�r�s r[rFzUpdate.returningL� ��58�Cr^� _Update__ent3r��*ReturningUpdate[Tuple[_T0, _T1, _T2, _T3]]c��dSrXrY)rur�r�r�r�s r[rFzUpdate.returningQ� ��:=�r^� _Update__ent4r��/ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4]]c��dSrXrY)rur�r�r�r�r�s r[rFzUpdate.returningZ� ��?B�cr^� _Update__ent5r��4ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]]c��dSrXrY)rur�r�r�r�r�r�s r[rFzUpdate.returningd� ��DG�3r^� _Update__ent6r��9ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]]c��dSrXrY)rur�r�r�r�r�r�rs r[rFzUpdate.returningo� ��IL�r^� _Update__ent7r��>ReturningUpdate[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]]c ��dSrXrY) rur�r�r�r�r�r�rrs r[rFzUpdate.returning{� �� �3r^r0rB� _Update__kwr�ReturningUpdate[Any]c��dSrXrY�rur0rs r[rFzUpdate.returning�� ��$'�3r^c��dSrXrYr s r[rFzUpdate.returning����#&�3r^r�)rwr�rUr<r�)r�r�rUr�)r�r�r�r�rUr�)r�r�r�r�r�r�rUr�) r�r�r�r�r�r�r�r�rUr�) r�r�r�r�r�r�r�r�r�r�rUr�)r�r�r�r�r�r�r�r�r�r�r�r�rUr�)r�r�r�r�r�r�r�r�r�r�r�r�rr�rUr)r�r�r�r�r�r�r�r�r�r�r�r�rr�rr�rUr)r0rBrrrUr )r�r�r�rcr�� is_updater9r�r�r��dp_dml_ordered_valuesr�r�r3r�r%r�r&r�r2r�r�rvr r�r�rr rFr�r�s@r[rr�s�����������N��I��'�8� 9� � 1� H� I� �)�4� 5� � 1� G� H� �)�7� 8� �,�C� D� �(�;� <� �!2�!=� >�*�!�8� � � � 6� 7� � :� ;� � 3�! 4�" � -�# .��* � � � � � �� � � ��[� �D�����[��$�W'� � .� .� .� �� .� � 3� 3� 3� �� 3� � 8� 8� 8� �� 8� � =� =� =� �� =� � B� B� B� �� B� � G� G� G� �� G� � L� L� L� �� L� � � � � �� � � '� '� '� �� '� '� '� '� '� '� '� '� '�kW'�W'�W'�W'r^rc��eZdZdZdS)�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�rYr^r[rr�r�r^rc��eZdZdZdZdZdejfdejfdejfdej fge j ze j zejzejzZd3d �Zerred4d���Zed5d���Zed6d���Zed7d���Zed8d���Zed9d"���Zed:d&���Zed;d*���Zed<d0���Zd<d1�Zd2Sd2S)=rz�Represent a DELETE construct. The :class:`_expression.Delete` object is created using the :func:`_expression.delete()` function. rTrzr�rrrBc�R�tjtj||���|_dSrorrrss r[rvzDelete.__init__�rtr^� _Delete__ent0r�rU�ReturningDelete[Tuple[_T0]]c��dSrXrY)rurs r[rFzDelete.returning�r�r^� _Delete__ent1r�� ReturningDelete[Tuple[_T0, _T1]]c��dSrXrY)rurrs r[rFzDelete.returning�r�r^� _Delete__ent2r��%ReturningDelete[Tuple[_T0, _T1, _T2]]c��dSrXrY)rurrrs r[rFzDelete.returning�r�r^� _Delete__ent3r��*ReturningDelete[Tuple[_T0, _T1, _T2, _T3]]c��dSrXrY)rurrrrs r[rFzDelete.returning�r�r^� _Delete__ent4r��/ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4]]c��dSrXrY)rurrrrr!s r[rFzDelete.returning�r�r^� _Delete__ent5r��4ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5]]c��dSrXrY)rurrrrr!r$s r[rFzDelete.returning�r�r^� _Delete__ent6r��9ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6]]c��dSrXrY)rurrrrr!r$r's r[rFzDelete.returning�rr^� _Delete__ent7r��>ReturningDelete[Tuple[_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7]]c ��dSrXrY) rurrrrr!r$r'r*s r[rFzDelete.returning�rr^r0rB� _Delete__kwr�ReturningDelete[Any]c��dSrXrY�rur0r-s r[rFzDelete.returningr r^c��dSrXrYr0s r[rFzDelete.returningrr^Nr�)rr�rUr)rr�rr�rUr)rr�rr�rr�rUr) rr�rr�rr�rr�rUr) rr�rr�rr�rr�r!r�rUr")rr�rr�rr�rr�r!r�r$r�rUr%)rr�rr�rr�rr�r!r�r$r�r'r�rUr()rr�rr�rr�rr�r!r�r$r�r'r�r*r�rUr+)r0rBr-rrUr.)r�r�r�rcr�� is_deleter9r�r�r�r3r�r%r�r&r�r2r�r�rvrr rFrYr^r[rr�s���������N��I��'�8� 9� � 1� H� I� �,�C� D� �(�;� <�  � � 6�  7� � :� ;� � 3� 4� � -� .�� � � � � �W'� � .� .� .� �� .� � 3� 3� 3� �� 3� � 8� 8� 8� �� 8� � =� =� =� �� =� � B� B� B� �� B� � G� G� G� �� G� � L� L� L� �� L� � � � � �� � � '� '� '� �� '� '� '� '� '� '� '�kW'�W'r^rc��eZdZdZdS)�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�rYr^r[r4r4r�r^r4)rSrTrUrV)rSrTrUr_)rSrTrUrb)urc� __future__r�collections.abc�abcr��operator�typingrrrrrr r r r r rrrrrr�rrrr��_typingrrrr�baserrrr r!r"r#r$r%r&r'r(�elementsr)r*r+r,r.rWr/r0r1r2r3r4r5r6r7�sqltypesr8�visitorsr9r;� util.typingr<r=r>r?r@rArBrCrDrErFrGrHrIrJrK�_TCCArLrprMrNrOrPrQrRr\rard� attrgetterrerV�_DMLColumnElementr�rT� plugin_forr�rr�DMLRolernr�r�r�r�rrrr4rYr^r[�<module>rFs= ���� #�"�"�"�"�"�)�)�)�)�)�)�����������������������������������!�!�!�!�!�!������������������������������������������� � � � � � �������������������������������������#�#�#�#�#�#�&�&�&�&�&�&�)�)�)�)�)�)�'�'�'�'�'�'�$�$�$�$�$�$�������������#�#�#�#�#�#�"�"�"�"�"�"�������������������������������!�!�!�!�!�!�'�'�'�'�'�'�#�#�#�#�#�#�"�"�"�"�"�"�#�#�#�#�#�#�������������-�-�-�-�-�-�"�"�"�"�"�"�������#�#�#�#�#�#�������(�(�(�(�(�(�#�#�#�#�#�#�(�(�(�(�(�(�������'�'�'�'�'�'�������������������#�#�#�#�#�#�� /�2�2�2�2�2�2�/�/�/�/�/�/�+�+�+�+�+�+�-�-�-�-�-�-�*�*�*�*�*�*�������������������������������������������������<�<�<�<�<�<�.�.�.�.�.�.�%�%�%�%�%�%�,�,�,�,�,�,�1�1�1�1�1�1�+�+�+�+�+�+�"�"�"�"�"�"�&�&�&�&�&�&�A�A�A�A�A�A�A�A�A�A�A�A�A�#�x�"�:�.�.�H�"�x�"�:�.�.�H�"�x�"�:�.�.�H� �W�T�������#�|�C�0�0�1����e�T�1�2��R �R �R �R �R �|�R �R �R �j����H�-�-�C@�C@�C@�C@�C@�X�C@�C@�.�-�C@�L����H�-�-�%�%�%�%�%�X�%�%�.�-�%�P����H�-�-�  �  �  �  �  �X�  �  �.�-�  �}�}�}�}�}� �M� �������}�}�}�@S�S�S�S�S��S�S�S�ll'�l'�l'�l'�l'�Z�l'�l'�l'�^ � � � � �f�.�s�3� � � �I �I �I �I �I �I �I �I �Xq'�q'�q'�q'�q'�\�:�q'�q'�q'�h � � � � �f�.�s�3� � � �u'�u'�u'�u'�u'�\�:�u'�u'�u'�p � � � � �f�.�s�3� � � � � r^
Memory