AlkantarClanX12

Your IP : 18.190.219.178


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/sql/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/sqlalchemy/sql/__pycache__/crud.cpython-311.pyc

�

�܋f[f��j�dZddlZddlmZddlmZddlmZddlmZejd	d
��Zejd��Z	ejd��Z
ejd
��Zd�Zd�Z
	d&d�Zd�Zd�Zd�Zd�Zd�Zd'd�Zd'd�ZGd�dej��Zd�Zd�Zd�Zd�Zd �Zd!�Zd"�Zd#�Zd$�Z d%�Z!dS)(ziFunctions used by compiler.py to determine the parameters rendered
within INSERT and UPDATE statements.

�N�)�dml)�elements�)�exc)�util�REQUIREDa8
Placeholder for the value within a :class:`.BindParameter`
which is required to be present when the statement is passed
to :meth:`_engine.Connection.execute`.

This symbol is typically used when a :func:`_expression.insert`
or :func:`_expression.update` statement is compiled without parameter
values present.

�ISINSERT�ISUPDATE�ISDELETEc���|j}|j}|j}|p|p|pt|j��dkpd|v}|t
urd|_d|_n5|turd|_d|_n|tur
|sd|_n
Jd���	|t
tfvr&t||fi|��|r||_||_||_SS	|r||_||_||_dSdS#|r||_||_||_wxYw)Nr�visiting_cteFTz(ISINSERT, ISUPDATE, or ISDELETE expected)	�isinsert�isupdate�isdelete�len�stackr
rr�_get_crud_params)�compiler�stmt�local_stmt_type�kw�restore_isinsert�restore_isupdate�restore_isdelete�should_restores        �J/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/sql/crud.py�_setup_crud_paramsr'st���(���(���(��
�	A�-�	A�1A�	 ��x�~����"�	 ��R����(�"�"�!��� ����	�H�	$�	$� ���!����	�H�	$�	$��	%� $�H���@�@�@�@�u�1��x��2�2�2�#�H�d�9�9�b�9�9��	1� 0�H�� 0�H�� 0�H���	1�3��	1� 0�H�� 0�H�� 0�H����	1�	1��>�	1� 0�H�� 0�H�� 0�H��0�0�0�0s�C�C1c�h��	�
�g�_g�_g�_g�_�j�|j��fd�|jjD��S|jr|jd�
n|j�
t�|��\�	}}�j�i}n!t�	�
fd��jD����}g}�
�t�|�
�	||��i}�jr|j
r�
rt�|�
|||||���jr|jrt#�|||�	||||�	�	nt%�|||�	||||�	�	|ry�
rwt'|����	fd��
D�����|��}|r4t-jdd�d�|D����z���|jrt3�|||��}|S)	aPcreate a set of tuples representing column/string pairs for use
    in an INSERT or UPDATE statement.

    Also generates the Compiled object's postfetch, prefetch, and
    returning column collections, used for default handling and ultimately
    populating the ResultProxy's prefetch_cols() and postfetch_cols()
    collections.

    Nc	�:��g|]}|t�|dd���f��S)NT)�required)�_create_bind_param)�.0�crs  �r�
<listcomp>z$_get_crud_params.<locals>.<listcomp>[s@���
�
�
���"�8�Q��t�D�D�D�E�
�
�
�rc3�H�K�|]}�r|�v��|��tfV��dS�N)r	)r#�key�_column_as_key�stmt_parameterss  ��r�	<genexpr>z#_get_crud_params.<locals>.<genexpr>ssS�����
�
��"�
�'*��&@�&@��^�C�
 �
 �(�+�&@�&@�&@�&@�
�
r&c3�.�K�|]}�|��V��dSr(�)r#�kr*s  �rr,z#_get_crud_params.<locals>.<genexpr>�s-�����E�E��.�.��+�+�E�E�E�E�E�Er&zUnconsumed column names: %sz, c3� K�|]	}d|zV��
dS)z%sNr.)r#r$s  rr,z#_get_crud_params.<locals>.<genexpr>�s&����5�5�!�T�A�X�5�5�5�5�5�5r&)�	postfetch�insert_prefetch�update_prefetch�	returning�column_keys�
parameters�table�columns�_has_multi_parameters�_key_getters_for_crud_column�dict�_get_stmt_parameters_paramsr�_extra_froms�_get_multitable_paramsr�select_names�_scan_insert_from_select_cols�
_scan_cols�set�intersection�
differencer�CompileError�join�_extend_values_for_multiparams)rrr�_getattr_col_key�_col_bind_namer6�values�
check_columns�checkr*r+s`        @@rrrHs�������H��!�H��!�H���H����#���(?�
�
�
�
��Z�'�
�
�
�	
�
�!�*��/�!�,����/��	%�X�t�4�4�	����
��#��
�
��
�
�
�
�
��+�
�
�
�
�
�
��F��"�#��j�/�>�6�2�	
�	
�	
��M���

�T�.�

�?�

����������		
�		
�		
���
�T�.�
�%����������
	
�
	
�
	
�
	
�	����������
	
�
	
�
	
��
�o�
��
�O�O�
�\�E�E�E�E�_�E�E�E�
E�
E�
�Z�
�
&�
&�	�
�	��"�-��9�9�5�5�u�5�5�5�5�5�7���
�
�!�L�/��$���K�K���Mr&TFc��|�|j}tj|||j|���}d|_|r|j|fi|��}|S)N)�type_r!T)r)r�
BindParameter�type�_is_crud�_compiler_dispatch)r�col�value�processr!�namer�	bindparams        rr"r"�se���|��w���&��e�3�8�h����I��I���A�0�I�0��@�@�R�@�@�	��r&c���|jr+|jr$t|j����fd�}�fd�}�fd�}n"tj}tjd��x}}|||fS)Nc�~��tj|��}t|d��r|j�vr|jj|fS|S)Nr7)rr*�hasattrr7rV)r)�str_key�_ets  �rr*z4_key_getters_for_crud_column.<locals>._column_as_key�sE����-�c�2�2�G��s�G�$�$�
���c�)9�)9��	���0�0��r&c�J��|j�vr|jj|jfS|jSr(�r7rVr)�rSr\s �rrHz6_key_getters_for_crud_column.<locals>._getattr_col_key�s(����y�C����	����0�0��w�r&c�P��|j�vr|jj�d|j��S|jS)N�_r^r_s �rrIz4_key_getters_for_crud_column.<locals>._col_bind_name�s.����y�C���"%�)�.�.�.�#�'�'�:�:��w�r&r))rr=rBrr*�operator�
attrgetter)rrr*rHrIr\s     @rr:r:�s������G�T�.�G��$�#�$�$��	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�"�0��,4�,?��,F�,F�F��>��+�^�;�;r&c	����t|���\}	}
}}��fd��jD��}
�j|_g}�jr>t|
��}�jjD]"}||vr|jr|
�	|���#|
D]U}||��}||vr1||vr-|�
|��|�	|df���Bt|�|||���V|rr|�|��|j�
��|_t|jj��td�|D����z|j_dSdS)Nc�F��g|]}�jj�|����Sr.�r7r$)r#rVr*rs  ��rr%z1_scan_insert_from_select_cols.<locals>.<listcomp>s,���M�M�M�4�D�J�L����-�-�.�M�M�Mr&c3� K�|]	\}}|V��
dSr(r.)r#rS�exprs   rr,z0_scan_insert_from_select_cols.<locals>.<genexpr>s&����8�8�9�3��$�8�8�8�8�8�8r&)�_get_returning_modifiersr?�select�_insert_from_select�#include_insert_from_select_defaultsrBr7r8�default�append�pop�&_append_param_insert_select_hasdefault�extend�	_generate�tuple�_raw_columns)rrr6rHr*rIrKrJr�need_pks�implicit_returning�implicit_return_defaults�postfetch_lastrowid�cols�add_select_cols�col_setrSr$�col_keys `  `              rr@r@�s�����"	!��4�0�0���� ��N�M�M�M�M�4�;L�M�M�M�D�#'�;�H� ��O��/�!��d�)�)���:�%�	!�	!�C��'�!�!�c�k�!����C� � � ��
����"�"�1�%�%���j� � �W�M�%A�%A��N�N�7�#�#�#��M�M�1�d�)�$�$�$�$�2��$��?�B�
�
�
�
��9��
�
�o�&�&�&�'/�'C�'M�'M�'O�'O��$�49��(�5�5
�5
��8�8��8�8�8�8�8�59��$�1�1�1�9�9r&c	
�����t|���\}	}
}}�jrJ�fd��jD��}
t|
����fd�|
D���fd��jjD��z}n�jj}|D�]K}||��}||vr||vrt
|�|||||
|||�
�
�/|jr�|jr>|	r<|
s|r|�jj	ur*|
rt|�|||���gt|�|||���{|j�t|�||||����|j�C|r||vr|j�|����|js|j�|����|r ||vr|j�|����|jr$|�jj	ur|jst'|����0|jrt+|�||||����MdS)Nc�&��g|]
}�|����Sr.r.)r#r)r*s  �rr%z_scan_cols.<locals>.<listcomp>2s0���
�
�
�$'�N�N�3���
�
�
r&c�4��g|]}�jj|��Sr.rf)r#r)rs  �rr%z_scan_cols.<locals>.<listcomp>6s"���@�@�@�c��
��S�!�@�@�@r&c�&��g|]
}|j�v�|��Sr.)r))r#r$�ordered_keyss  �rr%z_scan_cols.<locals>.<listcomp>6s/���D
�D
�D
��q�u�L�'@�'@�A�'@�'@�'@r&)ri�_parameter_orderingrBr7r$r8�_append_param_parameterr�primary_key�_autoincrement_column�!_append_param_insert_pk_returning�_append_param_insert_pkrm�_append_param_insert_hasdefault�server_defaultr4rnr1�nullable�"_warn_pk_with_no_anticipated_valuer�_append_param_update)rrr6rHr*rIrKrJrrurvrwrx�parameter_orderingryr$r|r�s `  `            @rrArAs������"	!��4�0�0���� ����	"�
�
�
�
�+/�+C�
�
�
���-�.�.��@�@�@�@�-?�@�@�@�D
�D
�D
�D
��z�|�D
�D
�D
�
����z�!��
�;�;��"�"�1�%�%���j� � �W�M�%A�%A�#�������"�(���
�
�
�
��
�)	��
�#
6��#
6�'�	#
6�
/�#
6���
� @�@�@�&�K�5� �$��6�2�����,�H�d�A�v�r�J�J�J�J���&�/��d�A�'?��������!�-�+�1��5M�0M�0M��&�-�-�a�0�0�0�0���1��&�-�-�a�0�0�0��)�
6�a�3K�.K�.K��"�)�)�!�,�,�,�,��
�
6��T�Z�=�=�=��
�>�3�1�5�5�5��
�
�	� ��$��#;�V�R�
�
�
��s;�;r&c
��|�|��}
tj|
��r9t|||
f|
tu|js||��n
d||��zd�|	��}
�nt
|
tj��r,|
jj	r |
�
��}
|j|
_|jr=|r;|j�
|��|j|
���fi|	��}
n�|r?||vr;|j�
|��|j|
���fi|	��}
nA|js|j�
|��|j|
���fi|	��}
|�
||
f��dS)Nz%s_m0�r!rV)ror�_is_literalr"r	r9�
isinstancerOrP�_isnull�_cloner�r4rnrU�
self_groupr1)rrr$r|r6rIrvrwrJrrTs           rr�r�zs���
�N�N�7�#�#�E���E�"�"�?�"��
��	
��h�&��-�-����"�"�"��>�>�!�,�,�,�	
�	
��	
�	
����e�X�3�4�4�	 ���9K�	 ��L�L�N�N�E���E�J��=�
	?�/�
	?���%�%�a�(�(�(�$�H�$�U�%5�%5�%7�%7�>�>�2�>�>�E�E�
%�
	?�!�/G�*G�*G���%�%�a�(�(�(�$�H�$�U�%5�%5�%7�%7�>�>�2�>�>�E�E��=�
-��"�)�)�!�,�,�,�$�H�$�U�%5�%5�%7�%7�>�>�2�>�>�E�
�M�M�1�e�*�����r&c��|j��|jjrj|jjrB|jjr|jjs*|j|jfi|��}|�||f��|j�|��dS|jj	r[|�||j|jj
���fi|��f��|j�|��dS|�|t||��f��dS||j
jus|j�|j�|��dS|jst#|��dSdS)a�Create a primary key expression in the INSERT statement and
    possibly a RETURNING clause for it.

    If the column has a Python-side default, we will create a bound
    parameter for it and "pre-execute" the Python function.  If
    the column has a SQL expression default, or is a sequence,
    we will add it directly into the INSERT statement and add a
    RETURNING element to get the new value.  If the column has a
    server side default or is marked as the "autoincrement" column,
    we will add a RETRUNING element to get at the value.

    If all the above tests fail, that indicates a primary key column with no
    noted default generation capabilities that has no parameter passed;
    raise an exception.

    N)rm�is_sequence�dialect�supports_sequences�optional�sequences_optionalrUrnr4�is_clause_element�argr��"_create_insert_prefetch_bind_paramr7r�r�r�r��rrr$rJr�procs      rr�r��s���"	�y���9� �	P���2�
)��I�&�
)��'�:�
)�(�x�'��	�8�8�R�8�8���
�
�q�$�i�(�(�(���%�%�a�(�(�(�(�(�
�Y�
(�	P��M�M��$�H�$�Q�Y�]�%=�%=�%?�%?�F�F�2�F�F�G�
�
�
�
��%�%�a�(�(�(�(�(��M�M�1�@��1�M�M�N�O�O�O�O�O�	
�d�j�.�	.�	.�!�2B�2N���!�!�!�$�$�$�$�$�
�Z�.�	+�1�-�-�-�-�-�.�.r&c�b�t||d||���}|j�|��|S�N)rUrV)r"r2rn�rr$rUrV�params     rr�r���6���x��D�'��M�M�M�E���#�#�A�&�&�&��Lr&c�b�t||d||���}|j�|��|Sr�)r"r3rnr�s     r�"_create_update_prefetch_bind_paramr��r�r&c��eZdZdZd�Zd�ZdS)�_multiparam_columnTc�z�||_d|j|dzfz|_||_|j|_|j|_dS)N�%s_m%dr)�indexr)�originalrmrP)�selfr�r�s   r�__init__z_multiparam_column.__init__�s>����
��x�|�U�Q�Y�7�7��� ��
��'����M��	�	�	r&c�l�t|t��o|j|jko|j|jkSr()r�r�r)r�)r��others  r�__eq__z_multiparam_column.__eq__�s7���u�0�1�1�
0��	�T�X�%�
0���$�-�/�	
r&N)�__name__�
__module__�__qualname__�_is_multiparam_columnr�r�r.r&rr�r��s8������ ��"�"�"�
�
�
�
�
r&r�c�>�|jstjd|z���|jjr*|j|jj���fi|��St||��}t|tj
��rt||��St||��S)Nz�INSERT value for column %s is explicitly rendered as a boundparameter in the VALUES clause; a Python-side value or SQL expression is required)
rmrrEr�rUr�r�r�r�r�Insertr�r�)rrr$r�rrSs      r� _process_multiparam_default_bindr��s����9�
E���
@�BC�
D�
�
�	
�

��	$�E��x���	�
� 8� 8� :� :�A�A�b�A�A�A� ��E�*�*���d�C�J�'�'�	E�5�h��D�D�D�5�h��D�D�Dr&c�2�|j�|jjr2|jjs&||jjur?|jjs|jjr'|�|t||��f��dS|j�|j	�|j
st|��dSdSdSdS)a�Create a bound parameter in the INSERT statement to receive a
    'prefetched' default value.

    The 'prefetched' value indicates that we are to invoke a Python-side
    default function or expliclt SQL expression before the INSERT statement
    proceeds, so that we have a primary key value available.

    if the column has no noted default generation capabilities, it has
    no value passed in either; raise an exception.

    N)rmr�r�r�r7r��"preexecute_autoincrement_sequencesrnr�r�r�r�)rrr$rJrs     rr�r�s���	
�	���	�%�	���2�		�	
�T�Z�
-�-�-�
��/�		.�
��B�	.�	�
�
�q�<�X�q�I�I�J�K�K�K�K�K�	
��	�q�/�7��
�7�	+�1�-�-�-�-�-�
�	�7�7�7�7r&c���|jjr�|jjr�|jjr|jjsq|j|jfi|��}|�||f��|r ||vr|j�|��dS|j	s |j
�|��dSdSdSdS|jjr�|j|jj�
��fi|��}|�||f��|r ||vr|j�|��dS|j	s|j
�|��dSdS|�|t||��f��dSr()rmr�r�r�r�r�rUrnr4r�r1r�r�r�r�)rrr$rwrJrr�s       rr�r�&s���	�y��L���.�	-��	�"�	-�*2�*:�*M�	-�$�8�#�A�I�4�4��4�4�D��M�M�1�d�)�$�$�$�'�
-�A�1I�,I�,I��"�)�)�!�,�,�,�,�,��]�
-��"�)�)�!�,�,�,�,�,�	-�	-�	-�	-�
-�
-�	
��	$�
L��x���	�
� 8� 8� :� :�A�A�b�A�A���
�
�q�$�i� � � �#�	)��-E�(E�(E���%�%�a�(�(�(�(�(���	)���%�%�a�(�(�(�(�(�	)�	)�	�
�
�q�<�X�q�I�I�J�K�K�K�K�Kr&c��|jjrZ|jjrJ|jjr|jjs4|j}|�||���f��dSdSdS|jjr7|jj	�
��}|�||f��dS|�|t||d���f��dS)NF)rU)rmr�r�r�r�r�rn�
next_valuer�r�r�r�r�s      rrprpAs����y��
���.�	2��	�"�	2�*2�*:�*M�	2��9�D��M�M�1�d�o�o�/�/�0�1�1�1�1�1�		2�	2�	2�	2�

��	$�
��y�}�'�'�)�)���
�
�q�$�i� � � � � ��
�
�
�2�8�Q��N�N�N�O�	
�	
�	
�	
�	
r&c�t�|j��|jjs�|jjr}|�||j|jj���fi|��f��|r ||vr|j�|��dS|j�|��dS|�|t||��f��dS|j
�>|r ||vr|j�|��dS|j�|��dS|r)|jdur"||vr |j�|��dSdSdSdS)NT)�onupdater�r�rnrUr�r�r4r1r��server_onupdate�_return_defaults)rrr$rwrJrs      rr�r�Rs���	�z��a�j�&<���:�'�		P��M�M��$�H�$�Q�Z�^�%>�%>�%@�%@�G�G�B�G�G�H�
�
�
�(�
-�A�1I�,I�,I��"�)�)�!�,�,�,�,�,��"�)�)�!�,�,�,�,�,��M�M�1�@��1�M�M�N�O�O�O�O�O�	
�	�	&�#�	)��-E�(E�(E���%�%�a�(�(�(�(�(���%�%�a�(�(�(�(�(� �%��!��-�-�
�)�)�)���!�!�!�$�$�$�$�$�%�%�-�-�)�)r&c���td�|���D����}t��}	|jD]�}
|
jD]�}||vr�|	�|
��||||��<||}t
j|��r%t||||tu||�����}n:|j
�|��|j|�
��fi|��}|�||f������|	D]�}
|
jD]�}||vr�|j��|jjs�|jjrZ|�||j|jj�
��fi|��f��|j
�|����|�|t%||||�����f����|j�|j
�|���ӌ�dS)Nc3�HK�|]\}}tj|��|fV��dSr()r�_clause_element_as_expr)r#r$r�s   rr,z)_get_multitable_params.<locals>.<genexpr>ysJ�������A�u�
�	)�!�	,�	,�e�4������r&r�)rV)r;�itemsrBr=r$�addrr�r"r	r1rnrUr�r�r�r�r�r�r�)
rrr+rKrIrHrJr�normalized_params�affected_tables�tr$rTs
             rr>r>ns������'�-�-�/�/��������e�e�O�
�
�*�*����	*�	*�A��%�%�%��#�#�A�&�&�&�56�
�.�.�q�1�1�2�)�!�,���'��.�.�
G�.� ���!&�(�!2�+�^�A�.�.����E�E��&�-�-�a�0�0�0�,�H�,�U�-=�-=�-?�-?�F�F�2�F�F�E��
�
�q�%�j�)�)�)��!	*�&�-�-����	-�	-�A��%�%�%����'��
�0F�'��:�/���M�M��,�H�,� !�
�� 9� 9� ;� ;���?A��������&�-�-�a�0�0�0�0��M�M��>� (�!�.�.��2C�2C����������"�.��"�)�)�!�,�,�,��1	-�-�-r&c
���|}|g}t|jdd���D]�\}}g}|D]�\}}	||vs	|j|vrs||vr|n|j}
tj||
��r%t||||
fdd|j|dzfzi|��}n:|j||
���fi|��}nt|||||��}|�	||f����|�	|����|S)NrrVr�)
�	enumerater6r)rr�r"rUr�r�rn)rrrJr�values_0�i�row�	extensionrSr�r)�	new_params            rrGrG�sQ���H��X�F��D�O�A�B�B�/�0�0�!�!���3��	�$�	/�	/�L�S�%��c�z�z�S�W��^�^� �C�Z�Z�c�c�S�W���'��C��1�1�	N� 2� ���C��!�!�&���!�a�%�(8�8�	!�
�!�!�I�I�!1�� 0��S��1D�1D�1F�1F� M� M�"� M� M�I�I�<��d�C��B���	�
���c�9�-�.�.�.�.��
�
�i� � � � ��Mr&c���|���D]�\}}||��}|�|�||���)tj|��r)|jtjd||j���fi|��}nM|jr&|jjr|�	|j��}|j|�
��fi|��}|�||f����dS)N)rN)r��
setdefaultrr�rUrOrP�_is_bind_parameterr��_with_binary_element_typer�rn)	rr6r+r*rJrr/�v�colkeys	         rr<r<�s�� �%�%�'�'�"�"���1����"�"�����!�!�&�!�,�,�,�,�
�#�A�&�&�
;�$�H�$��*�4��!�&�A�A�A���EG������'�<�A�F�N�<��3�3�A�F�;�;�A�$�H�$�Q�\�\�^�^�:�:�r�:�:���M�M�1�a�&�!�!�!�!�+"�"r&c��|jo|jo|jo|j}|o|jjo|jj}|jr
|o|j}n)|jr |jjo|jjo|j}nd}|r7|jdurt|jj
��}nt|j��}|o|jj}||||fS)NFT)r�inline�
_returningr9r�rvr7r�rrBr$rx)rrrurvrwrxs      rriri�s����	+����	+����	+��*�*�	
�	�	*���/�	*��J�)����)�#5�#O�$�:O� � �	�	�	)���/�
&��
�-�
&��%�	!� �$)� ��B�� �D�(�(�'*�4�:�<�'8�'8�$�$�'*�4�+@�'A�'A�$�"�K�x�'7�'K��	�� ��	�r&c��d|jj�d|j�d|jj�d�}t|jj��dkr|dz
}tj|��dS)NzColumn '�.z6' is marked as a member of the primary key for table 'z�', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed.  Primary key columns typically may not store NULL.ra0 Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be indicated explicitly for composite (e.g. multicolumn) primary keys if AUTO_INCREMENT/SERIAL/IDENTITY behavior is expected for one of the columns in the primary key. CREATE TABLE statements are impacted by this change as well on most backends.)r7�fullnamerVrr�r�warn)r$�msgs  rr�r�so���
�7����Q�V�V�V�Q�W�%5�%5�%5�
	7���1�7����!�#�#��
�	
��	�I�c�N�N�N�N�Nr&)TFN)TN)"�__doc__rb�rrrr�symbolr	r
rrrrr"r:r@rAr�r�r�r��
ColumnElementr�r�r�r�rpr�r>rGr<rir�r.r&r�<module>r�sC���������������������������������4�;��	�����4�;�z�"�"���4�;�z�"�"���4�;�z�"�"��1�1�1�Bq�q�q�j>B�����!<�!<�!<�H-9�-9�-9�`Y�Y�Y�x+�+�+�\&.�&.�&.�R��������
�
�
�
�
��/�
�
�
�$E�E�E�$".�".�".�JL�L�L�6
�
�
�"%�%�%�8=-�=-�=-�@���@"�"�"�6(�(�(�V����r&