� g\�g6/���dZddlmZddlmZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm 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+ejse(sdd%l,m-Z-ndd%l.m-Z-ejr dd&l/m0Z0dd'l1m2Z2ee3d(fZ4ee3d(e5fZ6e Z7ee4e7fZ8eee ee fZ9 ee d)fZ: ed*e9�+��Z;ed,e �+��Z<ed-ee d)f�+��Z=ee;e:fZ> eee e fZ?eed.Z@e ee gee fZAe e ge fZBeee eeBfZCGd/�d0��ZDGd1�d2ejEe ��ZFGd3�d4eD��ZG dVdWd;�ZHGd<�d=e��ZIeIjJZJGd>�d?e$e e;��ZKGd@�dA��ZLGdB�dCeLeKee=��ZMGdD�dEeKe;��ZNGdF�dGeNe;��ZOGdH�dIeNe;e jP��ZQGdJ�dKeLeNe��ZRGdL�dMe e=��ZSGdN�dOeMe=��ZTdXdQ�ZUGdR�dSeTe=��ZVGdT�dUeTe=��ZWdS)Yz%Define generic result set constructs.�)� annotations)�EnumN)�Any)�Callable)�cast)�Dict)�Generic)�Iterable)�Iterator)�List)�Mapping)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)� TYPE_CHECKING)�TypeVar)�Union�)�Row)� RowMapping�)�exc)�util)� _generative)� HasMemoized)�InPlaceGenerative)�!HasMemoized_ro_memoized_attribute)�NONE_SET)�HAS_CYEXTENSION)�Literal)�Self)� tuplegetter)�Column)�_ResultProcessorTypez Column[Any].�_R)�bound�_T�_TPz_ResultProcessorType[Any]c�V�eZdZUdZdZdZded<dZded<dZded <d ed <d ed <ded<ded<e dBd���Z dCd�Z dDd�Z e dEdFd!���Ze dEdGd$���Ze dEdHd&���Z dIdHd(�ZdJd+�ZdKd.�ZdLd2�ZdMd4�ZdNd5�Z dIdOd7�ZdPd9�ZdQd>�ZdRd@�Ze dSdA���ZdS)T�ResultMetaDataz$Base for metadata about result rows.�N�Optional[_TupleGetterType]� _tuplefilter�Optional[Sequence[int]]�_translated_indexes�(Optional[Sequence[Callable[[Any], Any]]]�_unique_filters� _KeyMapType�_keymap� Sequence[str]�_keys�Optional[_ProcessorsType]� _processors�Mapping[_KeyType, int]� _key_to_index�return� RMKeyViewc� �t|��S�N)r>��selfs �h/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sqlalchemy/engine/result.py�keyszResultMetaData.keysjs��������key�object�boolc��t���r@��NotImplementedError�rBrFs rC�_has_keyzResultMetaData._has_keyn���!�#�#�#rEc��t���r@rJrAs rC� _for_freezezResultMetaData._for_freezeqrNrE.r�err�Optional[Exception]�raiseerr� Literal[True]rc��dSr@r.�rBrFrQrSs rC� _key_fallbackzResultMetaData._key_fallbackts ���3rE�Literal[False]�Nonec��dSr@r.rVs rCrWzResultMetaData._key_fallbackys �� �srE�Optional[NoReturn]c��dSr@r.rVs rCrWzResultMetaData._key_fallback�s ��!�SrETc�*�|sJ�t|��|�r@)�KeyErrorrVs rCrWzResultMetaData._key_fallback�s�����x��s�m�m��$rE�rec�_KeyMapRecTypec� �td���)NzCambiguous column name logic is implemented for CursorResultMetaDatarJ)rBr_s rC� _raise_for_ambiguous_column_namez/ResultMetaData._raise_for_ambiguous_column_name�s��"� #� � � rE� _KeyIndexType� Optional[int]c��t���r@rJ�rBrFrSs rC�_index_for_keyzResultMetaData._index_for_key����"�#�#�#rErD�Sequence[_KeyIndexType]� Sequence[int]c��t���r@rJ�rBrDs rC�_indexes_for_keysz ResultMetaData._indexes_for_keys�rhrE�Iterator[_KeyMapRecType]c��t���r@rJrls rC�_metadata_for_keysz!ResultMetaData._metadata_for_keys�rhrEc��t���r@rJrls rC�_reducezResultMetaData._reduce�rNrE�#Optional[Callable[[Row[Any]], Any]]c�^�|�||��}|�tj|��SdSr@)rg�operator� itemgetter)rBrFrS�indexs rC�_getterzResultMetaData._getter�s5���#�#�C��2�2�� � ��&�u�-�-� -��4rE�_TupleGetterTypec�>�|�|��}t|�Sr@)rmr%)rBrD�indexess rC�_row_as_tuple_getterz#ResultMetaData._row_as_tuple_getter�s"���(�(��.�.���G�$�$rE�keymap� Mapping[_KeyType, Sequence[Any]]rw�intc�D���fd�|���D��S)Nc�8��i|]\}}|�� ||���Sr@r.)�.0rFr_rws �rC� <dictcomp>z5ResultMetaData._make_key_to_index.<locals>.<dictcomp>�s7��� � � ���S��5�z�%� ��U��%�%�%rE)�items)rBr}rws `rC�_make_key_to_indexz!ResultMetaData._make_key_to_index�s6��� � � � �"�L�L�N�N� � � � rE� attr_errorc��||jvr"|�|j|��dS|rF |�|d��dS#t$r }t |jd��|�d}~wwxYw|�|d��dS�Nr)r6rbrWr^�AttributeError�args)rBrFr��kes rC�_key_not_foundzResultMetaData._key_not_found�s��� �$�,� � � � 1� 1�$�,�s�2C� D� D� D� D� D�� .�=��&�&�s�D�1�1�1�1�1���=�=�=�(�����4�4�"�<�����=�����"�"�3��-�-�-�-�-s�A� A1�A,�,A1c�T�|jrtj|j��rdS|jSr@)r:r!� issupersetrAs rC�_effective_processorsz$ResultMetaData._effective_processors�s0���� $�8�#6�t�7G�#H�#H� $��4��#� #rE�r=r>�rFrGr=rH�r=r-).)rFrrQrRrSrTr=r)rFrrQrRrSrXr=rY)rFrrQrRrSrHr=r[�T)r_r`r=r)rFrcrSrHr=rd)rDrir=rj)rDrir=rn)rDrir=r-)rFrrSrHr=rs�rDrir=ry)r}r~rwrr=r;)rFrr�rHr=r)r=r9)�__name__� __module__� __qualname__�__doc__� __slots__r0�__annotations__r2r4�propertyrDrMrPrrWrbrgrmrprrrxr|r�r�r�r.rErCr-r-]sC�������.�.��I�/3�L�3�3�3�3�37��7�7�7�7�@D�O�D�D�D�D���������*�*�*�*�)�)�)�)� �����X��$�$�$�$�$�$�$�$��LO������X��� $'� �����X���CF�!�!�!�!��X�!� DH�%�%�%�%�%�  � � � �$�$�$�$� $�$�$�$� $�$�$�$� $�$�$�$�*.������%�%�%�%�  � � � � .� .� .� .��$�$�$��X�$�$�$rEr-c�`�eZdZUdZded<ded<dd�Zdd �Zdd �Zdd�Zdd�Z dd�Z dd�Z dS)r>��_parentr8r-r�r7r8�parentc�@�||_d�|jD��|_dS)Nc��g|]}|�|��Sr@r.)r��ks rC� <listcomp>z&RMKeyView.__init__.<locals>.<listcomp>�s��?�?�?�A���a���rEr�)rBr�s rC�__init__zRMKeyView.__init__�s$���� �?�?���?�?�?�� � � rEr=rc�*�t|j��Sr@)�lenr8rAs rC�__len__zRMKeyView.__len__�s���4�:���rE�strc�,�d�|��S)Nz#{0.__class__.__name__}({0._keys!r}))�formatrAs rC�__repr__zRMKeyView.__repr__�s��4�;�;�D�A�A�ArE� Iterator[str]c�*�t|j��Sr@)�iterr8rAs rC�__iter__zRMKeyView.__iter__�s���D�J���rE�itemrrHc�d�t|t��rdS|j�|��S�NF)� isinstancerr�rM)rBr�s rC� __contains__zRMKeyView.__contains__�s1�� �d�C� � � ��5��|�$�$�T�*�*�*rE�otherc�B�t|��t|��kSr@��list�rBr�s rC�__eq__zRMKeyView.__eq__�����E�{�{�d�4�j�j�(�(rEc�B�t|��t|��kSr@r�r�s rC�__ne__zRMKeyView.__ne__�r�rEN)r�r-)r=r)r=r�)r=r�)r�rr=rH)r�rr=rH) r�r�r�r�r�r�r�r�r�r�r�r�r.rErCr>r>�s��������$�I���������@�@�@�@�����B�B�B�B� � � � �+�+�+�+�)�)�)�)�)�)�)�)�)�)rEr>c�x�eZdZUdZdZded< d)d*d�Zd+d�Zd,d�Zd-d�Z d.d�Z d/d0d"�Z d1d%�Z d2d'�Z d3d(�ZdS)4�SimpleResultMetaDataz*result metadata for in-memory collections.)r8r6r:r0r2r4r<r7r8NrD�extra�Optional[Sequence[Any]]r:r9r0r/r2r1r4r3c�b�t|��|_||_||_||_|r-d�t t |j|����D��}nd�t |j��D��}d�|D��|_||_|� |jd��|_ dS)Nc�8�g|]\}\}}|f|r|ndz|||ff��S�r.r.)r�rw�name�extrass rCr�z1SimpleResultMetaData.__init__.<locals>.<listcomp>sQ����� *�E�>�D�&��G��7�v�v�R�8��D�&�)����rEc�$�g|] \}}|f||dff��Sr�r.)r�rwr�s rCr�z1SimpleResultMetaData.__init__.<locals>.<listcomp>s:������E�4���5�$��+�,���rEc�$�i|] \}}|D]}||���Sr.r.)r�rDr_rFs rCr�z1SimpleResultMetaData.__init__.<locals>.<dictcomp>!s+��M�M�M�Y�T�3��M�M���S�M�M�M�MrEr) r�r8r0r2r4� enumerate�zipr6r:r�r<)rBrDr�r:r0r2r4� recs_namess rCr�zSimpleResultMetaData.__init__s����$�Z�Z�� �(���#6�� �.��� � ��� .7�s�4�:�u�7M�7M�-N�-N� ���J�J���#,�T�Z�#8�#8����J� N�M�*�M�M�M�� �&���!�4�4�T�\�1�E�E����rErFrGr=rHc��||jvSr@�r6rLs rCrMzSimpleResultMetaData._has_key's���d�l�"�"rEr-c����j}|r�jr��|��}t�j�fd��jD��|���S)Nc�6��g|]}�j|d��S)rr��r�rFrBs �rCr�z4SimpleResultMetaData._for_freeze.<locals>.<listcomp>3s%���>�>�>�C�4�<��$�Q�'�>�>�>rE)r�r4)r4r0r�r8)rB�unique_filterss` rCrPz SimpleResultMetaData._for_freeze*sj����-�� � ?�d�/� ?�!�.�.�~�>�>�N�$� �J�>�>�>�>�4�:�>�>�>�*� � � � rE�Dict[str, Any]c� �|j|jd�S)N�r8r2r�rAs rC� __getstate__z!SimpleResultMetaData.__getstate__7s���Z�#'�#;� � � rE�staterYc�~�|dr|d}t|�}ndx}}|�|d||���dS)Nr2r8)r2r0)r%r�)rBr�r2r0s rC� __setstate__z!SimpleResultMetaData.__setstate__=sf�� �&� '� 6�"'�(=�">� �&�(;�<�L�L�15� 5� �,� � � � �'�N� 3�%� � � � � � rETrrSrc���t|jjvr |j|} |j|}n.#t $r!}|�|||��}Yd}~nd}~wwxYw|dSr��r� __class__�__mro__r8r6r^rW)rBrFrSr_r�s rCrgz#SimpleResultMetaData._index_for_keyIs{�� �#�-�'� '� '��*�S�/�C� 8��,�s�#�C�C��� 8� 8� 8��$�$�S�"�h�7�7�C�C�C�C�C�C����� 8�����1�v� s� 0� A�A�A� Sequence[Any]rjc� ���fd�|D��S)Nc�6��g|]}�j|d��S�rr�r�s �rCr�z:SimpleResultMetaData._indexes_for_keys.<locals>.<listcomp>Ts%���5�5�5��� �S�!�!�$�5�5�5rEr.rls` rCrmz&SimpleResultMetaData._indexes_for_keysSs���5�5�5�5��5�5�5�5rErnc#��K�|D]c}t|jjvr |j|} |j|}n.#t $r!}|�||d��}Yd}~nd}~wwxYw|V��ddS)NTr�)rBrDrFr_r�s rCrpz'SimpleResultMetaData._metadata_for_keysVs������ � �C��c�m�+�+�+��j��o�� 8��l�3�'����� 8� 8� 8��(�(��b�$�7�7����������� 8�����I�I�I�I� � s� 6� A!�A�A!c�.�� �fd�|D��}n9#t$r,}��|jd|d��Yd}~nd}~wwxYwt|�\}}}�jr�fd�|D��}t |�}t ||||�j�j���}|S)Nc�j��g|]/}�jt|jjvr �j|n|��0Sr.)r6rr�r�r8r�s �rCr�z0SimpleResultMetaData._reduce.<locals>.<listcomp>fsN���!�!�!��� �'*�c�m�.C�'C�'C�D�J�s�O�O���!�!�!rErTc�*��g|]}�j|��Sr.)r2)r��idxrBs �rCr�z0SimpleResultMetaData._reduce.<locals>.<listcomp>us!���H�H�H��t�/��4�H�H�HrE)r�r0r2r:r4) r^rWr�r�r2r%r�r:r4) rBrD�metadata_for_keysr�r{�new_keysr��tup� new_metadatas ` rCrrzSimpleResultMetaData._reduceds���� 5�!�!�!�!� � !�!�!� � �� � 5� 5� 5� � � �r�w�q�z�2�t� 4� 4� 4� 4� 4� 4� 4� 4����� 5���� $'�(9�#:� ���5� � #� I�H�H�H�H��H�H�H�G��7�#��+� ��� '��(� �0�  � � � ��s�� A�"A�A)NNNNN) rDr7r�r�r:r9r0r/r2r1r4r3r�r�)r=r�)r�r�r=rYr�)rFrrSrHr=r)rDr�r=rj)rDr�r=rn)rDr�r=r-)r�r�r�r�r�r�r�rMrPr�r�rgrmrprrr.rErCr�r��s�������4�4��I����� *.�15�37�7;�DH�F�F�F�F�F�B#�#�#�#�  �  �  �  � � � � �  �  �  �  ������6�6�6�6� � � � ������rEr��fieldsr7r�� Optional[Any]r=�#Callable[[Iterable[Any]], Row[Any]]c�n�t||��}tjt||j|j��Sr@)r�� functools�partialrr�r<)r�r�r�s rC� result_tupler��s7��"�&�%� 0� 0�F� � � �V�V�1�6�3G� � �rEc��eZdZdZdS)�_NoRowrN)r�r�r��_NO_ROWr.rErCr�r��s�������G�G�GrEr�c��eZdZUdZdZded<dZded<ded <dZd ed <dZded <d Z ded<ded<d<d�Z d=d>d�Z d?d@d�Z dAd�Z d=dBd�ZedCd ���ZedDd"���ZdEd$�ZdEd%�ZedFd'���ZedGd)���ZedHd/���ZedId1���ZdId2�ZdJd4�ZdKd5�ZedLd9���ZejdMd;���ZdS)N�ResultInternalr.N�Optional[Result[Any]]� _real_resultTrH�_generate_rows�Optional[Callable[[Any], Any]]�_row_logging_fnz Optional[_UniqueFilterStateType]�_unique_filter_state�_post_creational_filterFr-� _metadata�_source_supports_scalarsr=�#Iterator[_InterimRowType[Row[Any]]]c��t���r@rJrAs rC�_fetchiter_implzResultInternal._fetchiter_impl�rNrE� hard_close�#Optional[_InterimRowType[Row[Any]]]c��t���r@rJ�rBrs rC�_fetchone_implzResultInternal._fetchone_impl�rhrE�sizerd�List[_InterimRowType[Row[Any]]]c��t���r@rJ�rBrs rC�_fetchmany_implzResultInternal._fetchmany_impl�rhrEc��t���r@rJrAs rC�_fetchall_implzResultInternal._fetchall_impl�rNrE�hardrYc��t���r@rJ�rBrs rC� _soft_closezResultInternal._soft_close�rNrE�Optional[Callable[..., _R]]c��� � � � �|jr|jntd|��}|jr|jsdSt� d� fd � }nt}|j}|j}|j}|j}|r5|js.|r ||��}tj ||||��� |� d� � fd� }ntj ||||��}|j r|j �|� d�� fd� }|S)N� Result[Any]�metadatar-� processorsr9� key_to_indexr;� scalar_objrr=�Row[Any]c�"���||||f��Sr@r.)rrrr�_procs �rC� process_rowz/ResultInternal._row_getter.<locals>.process_row�s$��� !�5� �*�l�Z�M���rE�row�_InterimRowType[Row[Any]]r(c�,����|����Sr@r.)r�_make_row_orig�fixed_tfs ��rC�make_rowz,ResultInternal._row_getter.<locals>.make_row�s���%�~�h�h�s�m�m�4�4�4rEc�,����|����Sr@r.)r�_log_row� _make_rows ��rCr"z,ResultInternal._row_getter.<locals>.make_row�s����x� � �#���/�/�/rE) rr-rr9rr;rrr=r)rrr=r() r�rr�r�rr�r<r�r0r�r�r�) rB� real_resultrrrr�tfr"r$r%r rr!s @@@@@rC� _row_getterzResultInternal._row_getter�sk�������� � +�D� � ��m�T�*�*� � � /� ��&� ��t�����������K��>���-� ��3� � � "�� � �k�:� �� ,��R� �^�^� �09�0A��X�z�<�1�1�N��H� 5� 5� 5� 5� 5� 5� 5� 5�!�(��X�z�<���H� � &� 0�"�2�H� �I� 0� 0� 0� 0� 0� 0� 0��rE�Callable[..., Iterator[_R]]c�n�����|j�|j�|jr|j\��d����fd� }nd��fd� }|S)NrBrr=� Iterator[_R]c3���K�|���D]K}�r �|��n|}�r �|��n|}|�vr�%��|���r �|��}|V��LdSr@)r�add)rB�raw_row�obj�hashedr"�post_creational_filter�strategy�uniquess ����rC�iterrowsz1ResultInternal._iterator_getter.<locals>.iterrows�s������#�3�3�5�5� � �G�-5�B����)�)�)�7��/7�?�X�X�c�]�]�]�C�F���(�(� ��K�K��'�'�'�-�:�4�4�S�9�9���I�I�I�I� � rEc3�z�K�|���D]"}�r �|��n|}�r �|��}|V��#dSr@)r)rBr.rr"r1s ��rCr4z1ResultInternal._iterator_getter.<locals>.iterrowssm�����#�3�3�5�5���G�-5�B����)�)�)�7��.�:�4�4�S�9�9���I�I�I�I� �rE)rBrr=r+�r(r�r��_unique_strategy)rBr4r"r1r2r3s @@@@rC�_iterator_getterzResultInternal._iterator_getter�s��������#��!%�!=�� � $� � $� 5� �G�X� � � � � � � � � � � � � � � � � ��rE�List[_R]c�^��|j���J�|���}�fd�|D��S)Nc�&��g|] }�|����Sr.r.�r�rr"s �rCr�z0ResultInternal._raw_all_rows.<locals>.<listcomp>s!���.�.�.�#���� � �.�.�.rE)r(r )rB�rowsr"s @rC� _raw_all_rowszResultInternal._raw_all_rowssB����#���#�#�#��"�"�$�$��.�.�.�.��.�.�.�.rEc�������|j�|j�|���}�r�fd�|D��}n|}|jr%|j\���fd��fd�|D��D��}n|}�r�fd�|D��}|S)Nc�&��g|] }�|����Sr.r.r<s �rCr�z+ResultInternal._allrows.<locals>.<listcomp>'s!���7�7�7�3���#���7�7�7rEc�L��g|] \}}|�v� ��|���|��!Sr.�r-�r��made_row�sig_rowr3s �rCr�z+ResultInternal._allrows.<locals>.<listcomp>0sG��� � � �%�H�g��'�)�)�'�+�+�g�2F�2F�)��*�)�)rEc�2��g|]}|�r �|��n|f��Sr.r.�r�rDr2s �rCr�z+ResultInternal._allrows.<locals>.<listcomp>2sG���*�*�*� !�!�.6�D����*�*�*�H��*�*�*rEc�&��g|] }�|����Sr.r.�r�rr1s �rCr�z+ResultInternal._allrows.<locals>.<listcomp>?s2������03�&�&�s�+�+���rE)r�r(r r�r7)rBr=� made_rows� interim_rowsr"r1r2r3s @@@@rC�_allrowszResultInternal._allrowss�������!%�!=���#���"�"�$�$�� � �7�7�7�7�$�7�7�7�I�I��I� � $� %� $� 5� �G�X� � � � �*�*�*�*� %.� *�*�*� � � �L�L�%�L� !� �����7C����L��rE�1Callable[..., Union[Literal[_NoRow._NO_ROW], _R]]c�n�����|j�|j�|jr|j\��d����fd� }nd��fd� }|S)NrBrr=�Union[_NoRow, _R]c����|j} |��}|�tS�r �|��n|}�r �|��n|}|�vr�7��|���r �|��}|Sr@)rr�r-) rB�_onerowrr/r0r"r1r2r3s ����rC�onerowz-ResultInternal._onerow_getter.<locals>.onerowOs�����-��#�!�'�)�)�C��{�&��.6�>�H�H�S�M�M�M�3��3;�!C���#������!�W�,�,�$�#�K�K��/�/�/�1�>�"8�"8��"=�"=�C�"� rEc�z��|���}|�tS�r �|��n|}�r �|��}|Sr@)rr�)rBr� interim_rowr"r1s ��rCrRz-ResultInternal._onerow_getter.<locals>.onerowdsZ����)�)�+�+���;�"�N�*2�:���� � � �s� �.�J�&<�&<�[�&I�&I� �&�&rE)rBrr=rOr6)rBrRr"r1r2r3s @@@@rC�_onerow_getterzResultInternal._onerow_getterDs��������#��!%�!=�� � $�" '� $� 5� �G�X� #� #� #� #� #� #� #� #� #� #�* '� '� '� '� '� '� '�� rE�Callable[..., List[_R]]c�z������|j�|j�|jr|j\��dd ��d�����fd� }nd��fd� }|S)Nr"rr=� List[Any]r2�$Optional[Callable[[List[Any]], Any]]r3�Set[Any]r=r9c�~�����r�fd�|D��}�r�fd�|D��}n d�|D��}�fd�|D��S)Nc�&��g|] }�|����Sr.r.r<s �rCr�zFResultInternal._manyrow_getter.<locals>.filterrows.<locals>.<listcomp>��!���:�:�:�c�H�H�S�M�M�:�:�:rEc3�2�K�|]}|�|��fV��dSr@r.rGs �rC� <genexpr>zEResultInternal._manyrow_getter.<locals>.filterrows.<locals>.<genexpr>�sC�����!�!�;C��8�8�H�#5�#5�6�!�!�!�!�!�!rEc3�K�|]}||fV�� dSr@r.)r�rDs rCr_zEResultInternal._manyrow_getter.<locals>.filterrows.<locals>.<genexpr>�s'���� K� K�(�(�H�!5� K� K� K� K� K� KrEc�L��g|] \}}|�v� ��|���|��!Sr.rBrCs �rCr�zFResultInternal._manyrow_getter.<locals>.filterrows.<locals>.<listcomp>�sC������)��'��g�-�-�g�k�k�'�6J�6J�-��-�-�-rEr.)r"r=r2r3rJs` `` rC� filterrowsz2ResultInternal._manyrow_getter.<locals>.filterrows{s������ �;�:�:�:�:�T�:�:�:�D��L�!�!�!�!�GK�!�!�!�I�I�!L� K�d� K� K� K�I�����-6����rErB�ResultInternal[_R]�numrdc����g}|j}|��|jr|jntd|��}|jr |jx}}nT||��}t |��}��J�|���|� � ����|t |��z }n|}|�J�|rC||��}|sn5|���|� � ����|t |��z }|�C� r� fd�|D��}|S)Nrc�&��g|] }�|����Sr.r.rIs �rCr�zDResultInternal._manyrow_getter.<locals>.manyrows.<locals>.<listcomp>�s%���N�N�N�s�5�5�c�:�:�N�N�NrE)r r�r� _yield_perr��extend) rBrd�collect� _manyrowsr&� num_requiredr=rbr"r1r2r3s �����rC�manyrowsz0ResultInternal._manyrow_getter.<locals>.manyrows�sY���%'�� �0� ��;� �,�7��)�)�!�-��6�6� � #�-� :�-8�-C�C� �s�s�(�y��~�~��!�$�i�i��'�3�3�3����&�J�x��x��I�I����(+�S��\�\�'9� � �#&�L�����"�6�$�9�\�2�2�D�����N�N�"� �8�T�8�W�E�E����$'��W���#5�L�#�6�*�O�N�N�N�N�g�N�N�N�G��rEc����|�%|jr|jntd|��}|j}|�|��}�r�fd�|D��}�r�fd�|D��}|S)Nrc�&��g|] }�|����Sr.r.r<s �rCr�zDResultInternal._manyrow_getter.<locals>.manyrows.<locals>.<listcomp>�r]rEc�&��g|] }�|����Sr.r.rIs �rCr�zDResultInternal._manyrow_getter.<locals>.manyrows.<locals>.<listcomp>�s%���H�H�H�C�2�2�3�7�7�H�H�HrE)r�rrgr )rBrdr&r=r"r1s ��rCrlz0ResultInternal._manyrow_getter.<locals>.manyrows�s�����;� �,�7��)�)�!�-��6�6� � &�0�C�37�3G�3G��3L�3L���;�:�:�:�:�T�:�:�:�D�)�I�H�H�H�H�4�H�H�H�D�� rE) r"rr=rXr2rYr3rZr=r9)rBrcrdrdr=r9r6)rBrlrbr"r1r2r3s @@@@@rC�_manyrow_getterzResultInternal._manyrow_getterrs���������#��!%�!=�� � $�Y � $� 5� �G�X� � � � �*- �- �- �- �- �- �- �- �- �- �- �b � � � � � � �$�rE�raise_for_second_row�raise_for_nonerT�scalarr(c��dSr@r.�rBrqrrrss rC� _only_one_rowzResultInternal._only_one_row�s �� �SrE� Optional[_R]c��dSr@r.rus rCrvzResultInternal._only_one_row�s �� �srEc��|j}|d���}|�|rtjd���dS|r|jr d|_d}n|j} |r ||��n|}n#|�d����xYw|r�|jr�|j\}}|r ||��n|} |d���} | �t} nR |r || ��n| } |r| tusJ�| || ��kr�Dn|| kr�Ln#|�d����xYwn|d���} | �t} | tur.|�d���tj |rdnd���nt} |�d���|s|j } | r | |��}|r |r|dS|S) NT�rz&No row was found when one was requiredF�rz6Multiple rows were found when exactly one was requiredz6Multiple rows were found when one or none was requiredr) rr� NoResultFoundr�r�r(rr�r7r��MultipleResultsFoundr�) rBrqrrrsrRrr"r3r2�existing_row_hash�next_rowr1s rCrvzResultInternal._only_one_row�sk�� �$��.4�f��.E�.E�.E�� �;�� ��'�<�����t� � (�d�3� (�"'�D� ��H�H��'�H� �#+�4�(�(�3�-�-�-��C�C�� � � � �$� � '� '� '� ���� �- (��(� '�%)�$9�!���5=�$F�H�H�S�M�M�M�3�!��$*�F�d�$;�$;�$;�H��'�#*��� �9A�#O�8�8�H�#5�#5�#5�x��#�%�#+�7�#:�#:�#:�#:�0�H�H�X�4F�4F�F�F� (� G� �H�_�_�$�����(�(�d�(�3�3�3������!�6�T�2�2�2���#�&�H��w�&�&�� � �d� �+�+�+��.�%�#�L�L�#����'��H� � � �$� � '� '� '�� 2�%)�%A� "�%� 2�,�,�S�1�1�� � �h� ��q�6�M��Js� A�A2�/+C$�C$�$C=r+c�,�|�|��Sr@)r8rAs rC� _iter_implzResultInternal._iter_impl;s���$�$�T�*�*�*rEc�^�|�|��}|turt���|Sr@)rUr�� StopIteration�rBrs rC� _next_implzResultInternal._next_impl>s-���!�!�$�'�'�� �'�>�>��/�/� !��JrEr{rir$c���|jr|jntd|��}|jrt|��dkr|j�|��|_|jsJ�|S)Nrr)r�rr�r�r�rrr�)rBr{r&s rC�_column_sliceszResultInternal._column_slicesEsq��� � +�D� � ��m�T�*�*� � �3� =�s�7�|�|�q�7H�7H�!�^�3�3�G�<�<�D�N��"�"�"�"�� rE�_UniqueFilterStateTypec�X�|j�J�|j\}}|j�|jntd|��}|st|jjrh|jr|js|jjd}nG|jj}|jjr|j�|��}tj d|��}||fS)Nrr�_filter_on_values) r�r�rr�r4r�r�r0ru� methodcaller)rBr3r2r&�filterss rCr7zResultInternal._unique_strategyTs����(�4�4�4� �5����� �,� � � ��m�T�*�*� � � O�D�N�:� O��4� O��+� O� �>�9�!�<����.�8���>�.�C�"�n�9�9�'�B�B�G�#�0�1D�g�N�N���� � rE�r=r��F�rrHr=rr@�rrdr=r�r=r�rrHr=rY)r=r)r=r))r=r9)r=rM)r=rV)rqrHrrrTrsrHr=r()rqrHrrrHrsrHr=rw�r=r+�r=r()r{rir=r$)r=r�)r�r�r�r�r�r�r�r�r�� _is_cursorrrr r rr r(r8r>rLrUrprrvr�r�rr�r�memoized_attributer7r.rErCr�r��s���������I�*.�L�.�.�.�.��N�����3�3�3�3�=A��A�A�A�A�>B��B�B�B�B��J�����"�"�"�"�$�$�$�$�"'�$�$�$�$�$� %)�$�$�$�$�$� $�$�$�$�$�$�$�$�$�'�9�9�9�'�&�9�v'� � � �'�&� �D/�/�/�/� #�#�#�#�J'�+�+�+�'�&�+�Z'�`�`�`�'�&�`�D�����X�������X��T�T�T�T�l+�+�+�+������ � � ��[� ��#�!�!�!�$�#�!�!�!rEr�c�&�eZdZUdZded<dd�ZdS) � _WithKeysr.r-r�r=r>c��|jjS)akReturn an iterable view which yields the string keys that would be represented by each :class:`_engine.Row`. The keys can represent the labels of the columns returned by a core statement or the names of the orm classes returned by an orm execution. The view also can be tested for key containment using the Python ``in`` operator, which will test both for the string keys represented in the view, as well as for alternate keys such as column objects. .. versionchanged:: 1.4 a key view object is returned rather than a plain list. )r�rDrAs rCrDz_WithKeys.keysts��"�~�"�"rENr�)r�r�r�r�r�rDr.rErCr�r�ns;��������I�����#�#�#�#�#�#rEr�c��eZdZUdZdZdZded<dZded<dZd ed <e j ��Z d ed <dbd�Z dcd�Z ddd�Zded�Zedfd���Zedfd���Zedgd���Zedhdid!���Zdjd$�Zedkd(���Zedld+���Zedmdnd.���Zdmdnd/�Z dodpd4�Zdqd8�Zdrd:�Zedsd<���Zdsd=�Zdtd?�ZdudA�ZdvdC�Z dhdwdF�Z!dxdH�Z"dydJ�Z#dhdzdK�Z$dxdL�Z%dydM�Z&dydN�Z'ed{dP���Z(ed|dQ���Z(d|dR�Z(ed}dT���Z)ed~dV���Z)d~dW�Z)dvdX�Z*ed}dY���Z+ed|dZ���Z+d|d[�Z+dd]�Z,d�da�Z-dS)��Resulta\Represent a set of database results. .. versionadded:: 1.4 The :class:`_engine.Result` object provides a completely updated usage model and calling facade for SQLAlchemy Core and SQLAlchemy ORM. In Core, it forms the basis of the :class:`_engine.CursorResult` object which replaces the previous :class:`_engine.ResultProxy` interface. When using the ORM, a higher level object called :class:`_engine.ChunkedIteratorResult` is normally used. .. note:: In SQLAlchemy 1.4 and above, this object is used for ORM results returned by :meth:`_orm.Session.execute`, which can yield instances of ORM mapped objects either individually or within tuple-like rows. Note that the :class:`_engine.Result` object does not deduplicate instances or rows automatically as is the case with the legacy :class:`_orm.Query` object. For in-Python de-duplication of instances or rows, use the :meth:`_engine.Result.unique` modifier method. .. seealso:: :ref:`tutorial_fetching_rows` - in the :doc:`/tutorial/index` )r��__dict__Nz(Optional[Callable[[Row[Any]], Row[Any]]]r�FrHr�rdrgzutil.immutabledict[Any, Any]� _attributes�cursor_metadatar-c��||_dSr@)r�)rBr�s rCr�zResult.__init__�s ��(����rEr=r$c��|Sr@r.rAs rC� __enter__zResult.__enter__����� rE�type_r�value� tracebackrYc�.�|���dSr@)�close�rBr�r�r�s rC�__exit__zResult.__exit__�s�� � � � � � � � rEc�2�|�d���dS)a�close this :class:`_engine.Result`. The behavior of this method is implementation specific, and is not implemented by default. The method should generally end the resources in use by the result object and also cause any subsequent iteration or row fetching to raise :class:`.ResourceClosedError`. .. versionadded:: 1.4.27 - ``.close()`` was previously not generally available for all :class:`_engine.Result` classes, instead only being available on the :class:`_engine.CursorResult` returned for Core statement executions. As most other result objects, namely the ones used by the ORM, are proxying a :class:`_engine.CursorResult` in any case, this allows the underlying cursor result to be closed from the outside facade for the case when the ORM query is using the ``yield_per`` execution option where it does not immediately exhaust and autoclose the database cursor. Tr{N)rrAs rCr�z Result.close�s!��( ���d��#�#�#�#�#rEc��t���r@rJrAs rC� _soft_closedzResult._soft_closed�s��!�#�#�#rEc��t���)zkreturn ``True`` if this :class:`_engine.Result` reports .closed .. versionadded:: 1.4.43 rJrAs rC�closedz Result.closed����"�#�#�#rErdrc��||_|S)a�Configure the row-fetching strategy to fetch ``num`` rows at a time. This impacts the underlying behavior of the result when iterating over the result object, or otherwise making use of methods such as :meth:`_engine.Result.fetchone` that return one row at a time. Data from the underlying cursor or other data source will be buffered up to this many rows in memory, and the buffered collection will then be yielded out one row at a time or as many rows are requested. Each time the buffer clears, it will be refreshed to this many rows or as many rows remain if fewer remain. The :meth:`_engine.Result.yield_per` method is generally used in conjunction with the :paramref:`_engine.Connection.execution_options.stream_results` execution option, which will allow the database dialect in use to make use of a server side cursor, if the DBAPI supports a specific "server side cursor" mode separate from its default mode of operation. .. tip:: Consider using the :paramref:`_engine.Connection.execution_options.yield_per` execution option, which will simultaneously set :paramref:`_engine.Connection.execution_options.stream_results` to ensure the use of server side cursors, as well as automatically invoke the :meth:`_engine.Result.yield_per` method to establish a fixed row buffer size at once. The :paramref:`_engine.Connection.execution_options.yield_per` execution option is available for ORM operations, with :class:`_orm.Session`-oriented use described at :ref:`orm_queryguide_yield_per`. The Core-only version which works with :class:`_engine.Connection` is new as of SQLAlchemy 1.4.40. .. versionadded:: 1.4 :param num: number of rows to fetch each time the buffer is refilled. If set to a value below 1, fetches all rows for the next buffer. .. seealso:: :ref:`engine_stream_results` - describes Core behavior for :meth:`_engine.Result.yield_per` :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel` )rg�rBrds rC� yield_perzResult.yield_per�s��b���� rEr2�Optional[_UniqueFilterType]c�0�t��|f|_|S)aApply unique filtering to the objects returned by this :class:`_engine.Result`. When this filter is applied with no arguments, the rows or objects returned will filtered such that each row is returned uniquely. The algorithm used to determine this uniqueness is by default the Python hashing identity of the whole tuple. In some cases a specialized per-entity hashing scheme may be used, such as when using the ORM, a scheme is applied which works against the primary key identity of returned objects. The unique filter is applied **after all other filters**, which means if the columns returned have been refined using a method such as the :meth:`_engine.Result.columns` or :meth:`_engine.Result.scalars` method, the uniquing is applied to **only the column or columns returned**. This occurs regardless of the order in which these methods have been called upon the :class:`_engine.Result` object. The unique filter also changes the calculus used for methods like :meth:`_engine.Result.fetchmany` and :meth:`_engine.Result.partitions`. When using :meth:`_engine.Result.unique`, these methods will continue to yield the number of rows or objects requested, after uniquing has been applied. However, this necessarily impacts the buffering behavior of the underlying cursor or datasource, such that multiple underlying calls to ``cursor.fetchmany()`` may be necessary in order to accumulate enough objects in order to provide a unique collection of the requested size. :param strategy: a callable that will be applied to rows or objects being iterated, which should return an object that represents the unique value of the row. A Python ``set()`` is used to store these identities. If not passed, a default uniqueness strategy is used which may have been assembled by the source of this :class:`_engine.Result` object. ��setr��rBr2s rC�uniquez Result.unique s��L&)�U�U�H�$5��!�� rE�col_expressionsrcc�,�|�|��S)aEstablish the columns that should be returned in each row. This method may be used to limit the columns returned as well as to reorder them. The given list of expressions are normally a series of integers or string key names. They may also be appropriate :class:`.ColumnElement` objects which correspond to a given statement construct. .. versionchanged:: 2.0 Due to a bug in 1.4, the :meth:`_engine.Result.columns` method had an incorrect behavior where calling upon the method with just one index would cause the :class:`_engine.Result` object to yield scalar values rather than :class:`_engine.Row` objects. In version 2.0, this behavior has been corrected such that calling upon :meth:`_engine.Result.columns` with a single index will produce a :class:`_engine.Result` object that continues to yield :class:`_engine.Row` objects, which include only a single column. E.g.:: statement = select(table.c.x, table.c.y, table.c.z) result = connection.execute(statement) for z, y in result.columns("z", "y"): ... Example of using the column objects from the statement itself:: for z, y in result.columns( statement.selected_columns.c.z, statement.selected_columns.c.y ): ... .. versionadded:: 1.4 :param \*col_expressions: indicates columns to be returned. Elements may be integer row indexes, string column names, or appropriate :class:`.ColumnElement` objects corresponding to a select construct. :return: this :class:`_engine.Result` object with the modifications given. �r��rBr�s rC�columnszResult.columns5s��Z�"�"�?�3�3�3rErB�Result[Tuple[_T]]�ScalarResult[_T]c��dSr@r.rAs rC�scalarszResult.scalarsds��>A�crErw� Literal[0]c��dSr@r.�rBrws rCr�zResult.scalarsg� ���3rEr�ScalarResult[Any]c��dSr@r.r�s rCr�zResult.scalarsls��FI�crEc�"�t||��S)a@Return a :class:`_engine.ScalarResult` filtering object which will return single elements rather than :class:`_row.Row` objects. E.g.:: >>> result = conn.execute(text("select int_id from table")) >>> result.scalars().all() [1, 2, 3] When results are fetched from the :class:`_engine.ScalarResult` filtering object, the single column-row that would be returned by the :class:`_engine.Result` is instead returned as the column's value. .. versionadded:: 1.4 :param index: integer or row key indicating the column to be fetched from each row, defaults to ``0`` indicating the first column. :return: a new :class:`_engine.ScalarResult` filtering object referring to this :class:`_engine.Result` object. )� ScalarResultr�s rCr�zResult.scalarsos��.�D�%�(�(�(rETrFrSrsc�d�|jrtd���|j�||��S)zareturn a callable that will retrieve the given key from a :class:`_engine.Row`. �.can't use this function in 'only scalars' mode)r�rKr�rxrfs rCrxzResult._getter�s>�� � (� �%�@��� ��~�%�%�c�8�4�4�4rErDriryc�b�|jrtd���|j�|��S)zbreturn a callable that will retrieve the given keys from a :class:`_engine.Row`. r�)r�rKr�r|rls rC� _tuple_getterzResult._tuple_getter�s<�� � (� �%�@��� ��~�2�2�4�8�8�8rE� MappingResultc� �t|��S)a�Apply a mappings filter to returned rows, returning an instance of :class:`_engine.MappingResult`. When this filter is applied, fetching rows will return :class:`_engine.RowMapping` objects instead of :class:`_engine.Row` objects. .. versionadded:: 1.4 :return: a new :class:`_engine.MappingResult` filtering object referring to this :class:`_engine.Result` object. )r�rAs rC�mappingszResult.mappings�s���T�"�"�"rE�TupleResult[_TP]c��|S)z�Apply a "typed tuple" typing filter to returned rows. The :attr:`_engine.Result.t` attribute is a synonym for calling the :meth:`_engine.Result.tuples` method. .. versionadded:: 2.0 r.rAs rC�tzResult.t�s ��� rEc��|S)a,Apply a "typed tuple" typing filter to returned rows. This method returns the same :class:`_engine.Result` object at runtime, however annotates as returning a :class:`_engine.TupleResult` object that will indicate to :pep:`484` typing tools that plain typed ``Tuple`` instances are returned rather than rows. This allows tuple unpacking and ``__getitem__`` access of :class:`_engine.Row` objects to by typed, for those cases where the statement invoked itself included typing information. .. versionadded:: 2.0 :return: the :class:`_engine.TupleResult` type at typing time. .. seealso:: :attr:`_engine.Result.t` - shorter synonym :attr:`_engine.Row._t` - :class:`_engine.Row` version r.rAs rC�tuplesz Result.tuples�s ��0� rE�Iterator[_RowData]c��t���)z�Return a safe iterator that yields raw row data. This is used by the :meth:`_engine.Result.merge` method to merge multiple compatible results together. rJrAs rC�_raw_row_iteratorzResult._raw_row_iterator�r�rE�Iterator[Row[_TP]]c�*�|���Sr@�r�rAs rCr�zResult.__iter__������� � � rE�Row[_TP]c�*�|���Sr@�r�rAs rC�__next__zResult.__next__�r�rEr�Iterator[Sequence[Row[_TP]]]c#�BK�|j} |||��}|r|V�ndS�)a�Iterate through sub-lists of rows of the size given. Each list will be of the size given, excluding the last list to be yielded, which may have a small number of rows. No empty lists will be yielded. The result object is automatically closed when the iterator is fully consumed. Note that the backend driver will usually buffer the entire result ahead of time unless the :paramref:`.Connection.execution_options.stream_results` execution option is used indicating that the driver should not pre-buffer results, if possible. Not all drivers support this option and the option is silently ignored for those who do not. When using the ORM, the :meth:`_engine.Result.partitions` method is typically more effective from a memory perspective when it is combined with use of the :ref:`yield_per execution option <orm_queryguide_yield_per>`, which instructs both the DBAPI driver to use server side cursors, if available, as well as instructs the ORM loading internals to only build a certain amount of ORM objects from a result at a time before yielding them out. .. versionadded:: 1.4 :param size: indicate the maximum number of rows to be present in each list yielded. If None, makes use of the value set by the :meth:`_engine.Result.yield_per`, method, if it were called, or the :paramref:`_engine.Connection.execution_options.yield_per` execution option, which is equivalent in this regard. If yield_per weren't set, it makes use of the :meth:`_engine.Result.fetchmany` default, which may be backend specific and not well defined. :return: iterator of lists .. seealso:: :ref:`engine_stream_results` :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel` TN�rp�rBr�getter� partitions rC� partitionszResult.partitions�sD����b�%�� ���t�T�*�*�I�� ��������  rE�Sequence[Row[_TP]]c�*�|���S)z4A synonym for the :meth:`_engine.Result.all` method.�rLrAs rC�fetchallzResult.fetchall ����}�}���rE�Optional[Row[_TP]]c�F�|�|��}|turdS|S)a�Fetch one row. When all rows are exhausted, returns None. This method is provided for backwards compatibility with SQLAlchemy 1.x.x. To fetch the first row of a result only, use the :meth:`_engine.Result.first` method. To iterate through all rows, iterate the :class:`_engine.Result` object directly. :return: a :class:`_engine.Row` object if no filters are applied, or ``None`` if no rows remain. N�rUr�r�s rC�fetchonezResult.fetchone%s*�� �!�!�$�'�'�� �'�>�>��4��JrEc�.�|�||��S)a�Fetch many rows. When all rows are exhausted, returns an empty sequence. This method is provided for backwards compatibility with SQLAlchemy 1.x.x. To fetch rows in groups, use the :meth:`_engine.Result.partitions` method. :return: a sequence of :class:`_engine.Row` objects. .. seealso:: :meth:`_engine.Result.partitions` r�r s rC� fetchmanyzResult.fetchmany;s��&�#�#�D�$�/�/�/rEc�*�|���S)a�Return all rows in a sequence. Closes the result set after invocation. Subsequent invocations will return an empty sequence. .. versionadded:: 1.4 :return: a sequence of :class:`_engine.Row` objects. .. seealso:: :ref:`engine_stream_results` - How to stream a large result set without loading it completely in python. r�rAs rC�allz Result.allPs��"�}�}���rEc�2�|�ddd���S)a�Fetch the first row or ``None`` if no row is present. Closes the result set and discards remaining rows. .. note:: This method returns one **row**, e.g. tuple, by default. To return exactly one single scalar value, that is, the first column of the first row, use the :meth:`_engine.Result.scalar` method, or combine :meth:`_engine.Result.scalars` and :meth:`_engine.Result.first`. Additionally, in contrast to the behavior of the legacy ORM :meth:`_orm.Query.first` method, **no limit is applied** to the SQL query which was invoked to produce this :class:`_engine.Result`; for a DBAPI driver that buffers results in memory before yielding rows, all rows will be sent to the Python process and all but the first row will be discarded. .. seealso:: :ref:`migration_20_unify_select` :return: a :class:`_engine.Row` object, or None if no rows remain. .. seealso:: :meth:`_engine.Result.scalar` :meth:`_engine.Result.one` F�rqrrrs�rvrAs rC�firstz Result.firstcs)��F�!�!�!&�u�U�"� � � rEc�2�|�ddd���S)a�Return at most one result or raise an exception. Returns ``None`` if the result has no rows. Raises :class:`.MultipleResultsFound` if multiple rows are returned. .. versionadded:: 1.4 :return: The first :class:`_engine.Row` or ``None`` if no row is available. :raises: :class:`.MultipleResultsFound` .. seealso:: :meth:`_engine.Result.first` :meth:`_engine.Result.one` TFr�r�rAs rC� one_or_nonezResult.one_or_none�s(��*�!�!�!%�e�E�"� � � rEr*c��dSr@r.rAs rC� scalar_onezResult.scalar_one����36�3rEc��dSr@r.rAs rCr�zResult.scalar_one����!$�rEc�2�|�ddd���S)a*Return exactly one scalar result or raise an exception. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one`. .. seealso:: :meth:`_engine.ScalarResult.one` :meth:`_engine.Result.scalars` Tr�r�rAs rCr�zResult.scalar_one�s(���!�!�!%�d�4�"� � � rE� Optional[_T]c��dSr@r.rAs rC�scalar_one_or_nonezResult.scalar_one_or_none�s��EH�SrEr�c��dSr@r.rAs rCrzResult.scalar_one_or_none�r�rEc�2�|�ddd���S)a0Return exactly one scalar result or ``None``. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one_or_none`. .. seealso:: :meth:`_engine.ScalarResult.one_or_none` :meth:`_engine.Result.scalars` TFr�r�rAs rCrzResult.scalar_one_or_none�s(���!�!�!%�e�D�"� � � rEc�2�|�ddd���S)aeReturn exactly one row or raise an exception. Raises :class:`.NoResultFound` if the result returns no rows, or :class:`.MultipleResultsFound` if multiple rows would be returned. .. note:: This method returns one **row**, e.g. tuple, by default. To return exactly one single scalar value, that is, the first column of the first row, use the :meth:`_engine.Result.scalar_one` method, or combine :meth:`_engine.Result.scalars` and :meth:`_engine.Result.one`. .. versionadded:: 1.4 :return: The first :class:`_engine.Row`. :raises: :class:`.MultipleResultsFound`, :class:`.NoResultFound` .. seealso:: :meth:`_engine.Result.first` :meth:`_engine.Result.one_or_none` :meth:`_engine.Result.scalar_one` TFr�r�rAs rC�onez Result.one�s(��:�!�!�!%�d�5�"� � � rEc��dSr@r.rAs rCrsz Result.scalar�s��9<�rEc��dSr@r.rAs rCrsz Result.scalar�s�� �SrEc�2�|�ddd���S)a�Fetch the first column of the first row, and close the result set. Returns ``None`` if there are no rows to fetch. No validation is performed to test if additional rows remain. After calling this method, the object is fully closed, e.g. the :meth:`_engine.CursorResult.close` method will have been called. :return: a Python scalar value, or ``None`` if no rows remain. FTr�r�rAs rCrsz Result.scalar�s(���!�!�!&�u�T�"� � � rE�FrozenResult[_TP]c� �t|��S)aReturn a callable object that will produce copies of this :class:`_engine.Result` when invoked. The callable object returned is an instance of :class:`_engine.FrozenResult`. This is used for result set caching. The method must be called on the result when it has been unconsumed, and calling the method will consume the result fully. When the :class:`_engine.FrozenResult` is retrieved from a cache, it can be called any number of times where it will produce a new :class:`_engine.Result` object each time against its stored set of rows. .. seealso:: :ref:`do_orm_execute_re_executing` - example usage within the ORM to implement a result-set cache. )� FrozenResultrAs rC�freezez Result.freeze s��*�D�!�!�!rE�othersr�MergedResult[_TP]c�4�t|j|f|z��S)a�Merge this :class:`_engine.Result` with other compatible result objects. The object returned is an instance of :class:`_engine.MergedResult`, which will be composed of iterators from the given result objects. The new result will use the metadata from this result object. The subsequent result objects must be against an identical set of result / cursor metadata, otherwise the behavior is undefined. )� MergedResultr�)rBrs rC�mergez Result.merge!s���D�N�T�G�f�,<�=�=�=rE)r�r-�r=r$�r�rr�rr�rr=rY�r=rY�r=rH�rdrr=r$r@�r2r�r=r$�r�rcr=r$)rBr�r=r�)rBr�rwr�r=r�r�)rwrcr=r�r�)rFrcrSrHr=rsr�)r=r�)r=r��r=r�)r=r�)r=r�)rrdr=r�)r=r�)r=r�)rrdr=r�)rBr�r=r*�r=r)rBr�r=r�r=r�)r=r )rrr=r).r�r�r�r�r�r�r�r�rgr� immutabledictr�r�r�r�r�r�r�r�rr�r�r�rr�rxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrsrrr.rErCr�r��s#���������2*�I�@D�O�D�D�D�D�%*��*�*�*�*� $�J�$�$�$�$�0B��0B�0D�0D�K�D�D�D�D�)�)�)�)���������$�$�$�$�,�$�$�$��X�$��$�$�$��X�$��1�1�1��[�1�f�&�&�&�&��[�&�P-4�-4�-4�-4�^�A�A�A��X�A� �����X���I�I�I�I��X�I�)�)�)�)�)�448� 5� 5� 5� 5� 5� 9� 9� 9� 9�#�#�#�#�"� � � ��X� �����4$�$�$�$�!�!�!�!�!�!�!�!�%)�8�8�8�8�8�t���� ����,0�0�0�0�0�*����&% �% �% �% �N � � � �2�6�6�6��X�6� �$�$�$��X�$� � � � �"�H�H�H��X�H� �6�6�6��X�6� � � � �" � � � �B�<�<�<��X�<� � � � ��X� � � � � �$"�"�"�"�.>�>�>�>�>�>rEr�c���eZdZUdZdZded<ded<d'd �Zd(d�Zed)d���Z d*d+d�Z e d,d���Z e d,d���Z d-d�Ze d.d���Zd/d�Z d*d0d �Zd1d"�Z d2d3d&�Zd#S)4� FilterResultaZA wrapper for a :class:`_engine.Result` that returns objects other than :class:`_engine.Row` objects, such as dictionaries or scalar objects. :class:`_engine.FilterResult` is the common base for additional result APIs including :class:`_engine.MappingResult`, :class:`_engine.ScalarResult` and :class:`_engine.AsyncResult`. )r�r�r�r�r�r�r�rr�r=r$c��|Sr@r.rAs rCr�zFilterResult.__enter__Hr�rEr�rr�r�rYc�>�|j�|||��dSr@)r�r�r�s rCr�zFilterResult.__exit__Ks#�� ��"�"�5�%��;�;�;�;�;rErdrc�D�|j�|��|_|S)a�Configure the row-fetching strategy to fetch ``num`` rows at a time. The :meth:`_engine.FilterResult.yield_per` method is a pass through to the :meth:`_engine.Result.yield_per` method. See that method's documentation for usage notes. .. versionadded:: 1.4.40 - added :meth:`_engine.FilterResult.yield_per` so that the method is available on all result set implementations .. seealso:: :ref:`engine_stream_results` - describes Core behavior for :meth:`_engine.Result.yield_per` :ref:`orm_queryguide_yield_per` - in the :ref:`queryguide_toplevel` )r�r�r�s rCr�zFilterResult.yield_perNs"��&!�-�7�7��<�<���� rEFrrHc�<�|j�|���dS�Nr{)r�rrs rCrzFilterResult._soft_closeds"�� ��%�%�4�%�0�0�0�0�0rEc��|jjSr@)r�r�rAs rCr�zFilterResult._soft_closedgs��� �-�-rEc��|jjS)z|Return ``True`` if the underlying :class:`_engine.Result` reports closed .. versionadded:: 1.4.43 )r�r�rAs rCr�zFilterResult.closedks��� �'�'rEc�8�|j���dS)zUClose this :class:`_engine.FilterResult`. .. versionadded:: 1.4.43 N)r�r�rAs rCr�zFilterResult.closeus�� ����!�!�!�!�!rE�Dict[Any, Any]c��|jjSr@)r�r�rAs rCr�zFilterResult._attributes}s��� �,�,rEr�c�4�|j���Sr@)r�rrAs rCrzFilterResult._fetchiter_impl�s��� �0�0�2�2�2rErrc�8�|j�|���S)Nrz)r�rrs rCrzFilterResult._fetchone_impl�s��� �/�/�:�/�F�F�FrErc�4�|j���Sr@)r�r rAs rCr zFilterResult._fetchall_impl�s��� �/�/�1�1�1rENrrdc�8�|j�|���S�N�r)r�r r s rCr zFilterResult._fetchmany_impl�s��� �0�0�d�0�;�;�;rErrrr�r�rr)r=r)r�r�r�r@r�)r�r�r�r�r�r�r�r�rr�rr�r�r�r�r�rrr r r.rErCr r 2s����������I�<�;�;�;���������<�<�<�<������[��*1�1�1�1�1��.�.�.��X�.��(�(�(��X�(�"�"�"�"��-�-�-��X�-�3�3�3�3�"'�G�G�G�G�G� 2�2�2�2�%)�<�<�<�<�<�<�<rEr c��eZdZUdZdZdZded<d!d �Zd"d#d�Zd"d$d�Z d%d�Z d"d&d�Z d%d�Z d'd�Z d(d�Zd)d�Zd)d�Zd(d �Zd S)*r�a�A wrapper for a :class:`_engine.Result` that returns scalar values rather than :class:`_row.Row` values. The :class:`_engine.ScalarResult` object is acquired by calling the :meth:`_engine.Result.scalars` method. A special limitation of :class:`_engine.ScalarResult` is that it has no ``fetchone()`` method; since the semantics of ``fetchone()`` are that the ``None`` value indicates no more results, this is not compatible with :class:`_engine.ScalarResult` since there is no way to distinguish between ``None`` as a row value versus ``None`` as an indicator. Use ``next(result)`` to receive values individually. r.Fr�r�r&rrwrcc���||_|jr|j|_d|_n9|j�|g��|_t jd��|_|j|_dSr�)r�r�r�r�rrrurvr�)rBr&rws rCr�zScalarResult.__init__�si��'��� � /� B�(�2�D�N�+/�D� (� (�(�2�:�:�E�7�C�C�D�N�+3�+>�q�+A�+A�D� (�$/�$D��!�!�!rENr2r�r=r$c�0�t��|f|_|S)z�Apply unique filtering to the objects returned by this :class:`_engine.ScalarResult`. See :meth:`_engine.Result.unique` for usage details. r�r�s rCr�zScalarResult.unique����&)�U�U�H�$5��!�� rErrd�Iterator[Sequence[_R]]c#�BK�|j} |||��}|r|V�ndS�)z�Iterate through sub-lists of elements of the size given. Equivalent to :meth:`_engine.Result.partitions` except that scalar values, rather than :class:`_engine.Row` objects, are returned. TNr�r�s rCr�zScalarResult.partitions�sC�����%�� ���t�T�*�*�I�� ��������  rE� Sequence[_R]c�*�|���S)�:A synonym for the :meth:`_engine.ScalarResult.all` method.r�rAs rCr�zScalarResult.fetchall�r�rEc�.�|�||��S)z�Fetch many objects. Equivalent to :meth:`_engine.Result.fetchmany` except that scalar values, rather than :class:`_engine.Row` objects, are returned. r�r s rCr�zScalarResult.fetchmany�s���#�#�D�$�/�/�/rEc�*�|���S)z�Return all scalar values in a sequence. Equivalent to :meth:`_engine.Result.all` except that scalar values, rather than :class:`_engine.Row` objects, are returned. r�rAs rCr�zScalarResult.all�s���}�}���rEr+c�*�|���Sr@r�rAs rCr�zScalarResult.__iter__�r�rEr(c�*�|���Sr@r�rAs rCr�zScalarResult.__next__�r�rErwc�2�|�ddd���S)z�Fetch the first object or ``None`` if no object is present. Equivalent to :meth:`_engine.Result.first` except that scalar values, rather than :class:`_engine.Row` objects, are returned. Fr�r�rAs rCr�zScalarResult.first��(���!�!�!&�u�U�"� � � rEc�2�|�ddd���S)z�Return at most one object or raise an exception. Equivalent to :meth:`_engine.Result.one_or_none` except that scalar values, rather than :class:`_engine.Row` objects, are returned. TFr�r�rAs rCr�zScalarResult.one_or_none��(���!�!�!%�e�E�"� � � rEc�2�|�ddd���S)z�Return exactly one object or raise an exception. Equivalent to :meth:`_engine.Result.one` except that scalar values, rather than :class:`_engine.Row` objects, are returned. TFr�r�rAs rCrzScalarResult.one�(���!�!�!%�d�5�"� � � rE)r&rrwrcr@r�rrdr=r5�r=r7�rrdr=r7r�r��r=rw)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr.rErCr�r��s'������� � ��I��N�;�;�;�;� E� E� E� E�����������$���� 0�0�0�0�0�����!�!�!�!�!�!�!�!�  �  �  �  �  �  �  �  �  �  �  �  �  �  rEr�c��eZdZdZdZer� d%d&d�Zd'd �Zd(d �Zd%d)d �Z d(d�Z d*d�Z d+d�Z d'd�Z d'd�Zd+d�Zed,d���Zed-d���Zd-d�Zed.d���Zed/d ���Zd/d!�Zed.d"���Zed-d#���Zd-d$�ZdSdS)0� TupleResultaA :class:`_engine.Result` that's typed as returning plain Python tuples instead of rows. Since :class:`_engine.Row` acts like a tuple in every way already, this class is a typing only class, regular :class:`_engine.Result` is still used at runtime. r.Nrrdr=r5c��dS)z�Iterate through sub-lists of elements of the size given. Equivalent to :meth:`_engine.Result.partitions` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.r s rCr�zTupleResult.partitions#s �� �CrErwc��dS)z�Fetch one tuple. Equivalent to :meth:`_engine.Result.fetchone` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.rAs rCr�zTupleResult.fetchone/� �� �CrEr7c��dS)r9Nr.rAs rCr�zTupleResult.fetchall9s�� �CrEc��dS)z�Fetch many objects. Equivalent to :meth:`_engine.Result.fetchmany` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.r s rCr�zTupleResult.fetchmany=rLrEc��dS)z�Return all scalar values in a sequence. Equivalent to :meth:`_engine.Result.all` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.rAs rCr�zTupleResult.allGrLrEr+c��dSr@r.rAs rCr�zTupleResult.__iter__Q����rEr(c��dSr@r.rAs rCr�zTupleResult.__next__SrQrEc��dS)z�Fetch the first object or ``None`` if no object is present. Equivalent to :meth:`_engine.Result.first` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.rAs rCr�zTupleResult.firstUs �� �CrEc��dS)z�Return at most one object or raise an exception. Equivalent to :meth:`_engine.Result.one_or_none` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.rAs rCr�zTupleResult.one_or_none`rLrEc��dS)z�Return exactly one object or raise an exception. Equivalent to :meth:`_engine.Result.one` except that tuple values, rather than :class:`_engine.Row` objects, are returned. Nr.rAs rCrzTupleResult.onejrLrErB�TupleResult[Tuple[_T]]r*c��dSr@r.rAs rCr�zTupleResult.scalar_onets��<?�CrErc��dSr@r.rAs rCr�zTupleResult.scalar_onews��%(�SrEc��dS)aBReturn exactly one scalar result or raise an exception. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one`. .. seealso:: :meth:`_engine.ScalarResult.one` :meth:`_engine.Result.scalars` Nr.rAs rCr�zTupleResult.scalar_onez� �� �CrErc��dSr@r.rAs rCrzTupleResult.scalar_one_or_none�r�rEr�c��dSr@r.rAs rCrzTupleResult.scalar_one_or_none�s��7:�srEc��dS)aBReturn exactly one or no scalar result. This is equivalent to calling :meth:`_engine.Result.scalars` and then :meth:`_engine.ScalarResult.one_or_none`. .. seealso:: :meth:`_engine.ScalarResult.one_or_none` :meth:`_engine.Result.scalars` Nr.rAs rCrzTupleResult.scalar_one_or_none�rZrEc��dSr@r.rAs rCrszTupleResult.scalar�s��BE�#rEc��dSr@r.rAs rCrszTupleResult.scalar�r�rEc��dS)a�Fetch the first column of the first row, and close the result set. Returns ``None`` if there are no rows to fetch. No validation is performed to test if additional rows remain. After calling this method, the object is fully closed, e.g. the :meth:`_engine.CursorResult.close` method will have been called. :return: a Python scalar value , or ``None`` if no rows remain. Nr.rAs rCrszTupleResult.scalar�s �� �CrEr@rDrGrErFr�r�)rBrVr=r*r)rBrVr=rr)r�r�r�r�r�rr�r�r�r�r�r�r�r�r�rrr�rrsr.rErCrIrIs����������I��T�)-� � � � � � � � � � � � � � � � � � � � � � � 0�/�/�/�%�%�%�%� � � � � � � � � � � � � �?�?�?� ��?� �(�(�(� ��(� � � � � � � � � �� � �:�:�:� ��:� � � � � �E�E�E� ��E� �$�$�$� ��$� � � � � � �KT�TrErIc��eZdZdZdZdZejd��Zd"d�Z d#d$d �Z d%d�Z d#d&d�Z d'd�Z d(d�Zd#d)d�Zd'd�Zd*d�Zd+d�Zd(d�Zd(d �Zd+d!�ZdS),r�z�A wrapper for a :class:`_engine.Result` that returns dictionary values rather than :class:`_engine.Row` values. The :class:`_engine.MappingResult` object is acquired by calling the :meth:`_engine.Result.mappings` method. r.T�_mapping�resultrc��||_|j|_|j|_|jr"|j�dg��|_dSdSr�)r�r�r�r�rr�rBrcs rCr�zMappingResult.__init__�sQ��"���$*�$?��!��)��� � *� 9�!�^�3�3�Q�C�8�8�D�N�N�N� 9� 9rENr2r�r=r$c�0�t��|f|_|S)z�Apply unique filtering to the objects returned by this :class:`_engine.MappingResult`. See :meth:`_engine.Result.unique` for usage details. r�r�s rCr�zMappingResult.unique�r4rEr�rcc�,�|�|��S)z:Establish the columns that should be returned in each row.r�r�s rCr�zMappingResult.columns�s���"�"�?�3�3�3rErrd�Iterator[Sequence[RowMapping]]c#�BK�|j} |||��}|r|V�ndS�)z�Iterate through sub-lists of elements of the size given. Equivalent to :meth:`_engine.Result.partitions` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. TNr�r�s rCr�zMappingResult.partitions�sC�����%�� ���t�T�*�*�I�� ��������  rE�Sequence[RowMapping]c�*�|���S)z;A synonym for the :meth:`_engine.MappingResult.all` method.r�rAs rCr�zMappingResult.fetchall�r�rE�Optional[RowMapping]c�F�|�|��}|turdS|S)z�Fetch one object. Equivalent to :meth:`_engine.Result.fetchone` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. Nr�r�s rCr�zMappingResult.fetchone�s*���!�!�$�'�'�� �'�>�>��4��JrEc�.�|�||��S)z�Fetch many objects. Equivalent to :meth:`_engine.Result.fetchmany` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. r�r s rCr�zMappingResult.fetchmanys���#�#�D�$�/�/�/rEc�*�|���S)z�Return all scalar values in a sequence. Equivalent to :meth:`_engine.Result.all` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. r�rAs rCr�zMappingResult.alls���}�}���rE�Iterator[RowMapping]c�*�|���Sr@r�rAs rCr�zMappingResult.__iter__r�rErc�*�|���Sr@r�rAs rCr�zMappingResult.__next__r�rEc�2�|�ddd���S)z�Fetch the first object or ``None`` if no object is present. Equivalent to :meth:`_engine.Result.first` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. Fr�r�rAs rCr�zMappingResult.first r?rEc�2�|�ddd���S)z�Return at most one object or raise an exception. Equivalent to :meth:`_engine.Result.one_or_none` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. TFr�r�rAs rCr�zMappingResult.one_or_none-rArEc�2�|�ddd���S)z�Return exactly one object or raise an exception. Equivalent to :meth:`_engine.Result.one` except that :class:`_engine.RowMapping` values, rather than :class:`_engine.Row` objects, are returned. TFr�r�rAs rCrzMappingResult.one9rCrE)rcrr@rr)rrdr=rh)r=rj)r=rl)rrdr=rj)r=rp)r=r)r�r�r�r�r�r�ru� attrgetterr�r�r�r�r�r�r�r�r�r�r�r�r�rr.rErCr�r��sU���������I��N�1�h�1�*�=�=��9�9�9�9������4�4�4�4� %)������(���� � � � � 0� 0� 0� 0� 0� � � � �!�!�!�!�!�!�!�!�  �  �  �  �  �  �  �  �  �  �  �  �  �  rEr�c�>�eZdZUdZded<dd�Zdd �Zdd �Zdd�ZdS)r a�Represents a :class:`_engine.Result` object in a "frozen" state suitable for caching. The :class:`_engine.FrozenResult` object is returned from the :meth:`_engine.Result.freeze` method of any :class:`_engine.Result` object. A new iterable :class:`_engine.Result` object is generated from a fixed set of data each time the :class:`_engine.FrozenResult` is invoked as a callable:: result = connection.execute(query) frozen = result.freeze() unfrozen_result_one = frozen() for row in unfrozen_result_one: print(row) unfrozen_result_two = frozen() rows = unfrozen_result_two.all() # ... etc .. versionadded:: 1.4 .. seealso:: :ref:`do_orm_execute_re_executing` - example usage within the ORM to implement a result-set cache. :func:`_orm.loading.merge_frozen_result` - ORM function to merge a frozen result back into a :class:`_orm.Session`. r��datarc� Result[_TP]c��|j���|_|j|_|j|_|jr(t |�����|_dS|���|_dSr@) r�rPrr�r�r�r�rxr�res rCr�zFrozenResult.__init__osm���(�4�4�6�6�� �(.�(G��%�!�-��� � (� *��V�5�5�7�7�8�8�D�I�I�I����)�)�D�I�I�IrEr=�Sequence[Sequence[Any]]c�T�|jrd�|jD��Sd�|jD��S)Nc��g|]}|g��Sr.r.)r��elems rCr�z-FrozenResult.rewrite_rows.<locals>.<listcomp>{s��1�1�1�t�T�F�1�1�1rEc�,�g|]}t|����Sr.r�)r�rs rCr�z-FrozenResult.rewrite_rows.<locals>.<listcomp>}s��3�3�3�#�D��I�I�3�3�3rE)r�rxrAs rC� rewrite_rowszFrozenResult.rewrite_rowsys9�� � (� 4�1�1�t�y�1�1�1� 1�3�3���3�3�3� 3rE� tuple_datar�r c���t�t��}|j|_|j|_|j|_|jrd�|D��|_n||_|S)Nc��g|] }|d�� Sr�r.)r��ds rCr�z.FrozenResult.with_new_rows.<locals>.<listcomp>�s��0�0�0��q��t�0�0�0rE)r �__new__rr�r�rx)rBr��frs rC� with_new_rowszFrozenResult.with_new_rowssc��� !� !�,� /� /���m�� ��)���&*�&C��#� � (� !�0�0�Z�0�0�0�B�G�G� �B�G�� rEc��t|jt|j����}|j|_|j|_|Sr@)�IteratorResultrr�rxr�r�res rC�__call__zFrozenResult.__call__�s=��&4� �M�4�� �?�?�' �' ��"�-���*.�*G��'�� rEN)rcry)r=r{)r�r�r=r )r=ry) r�r�r�r�r�r�r�r�r�r.rErCr r Fs�������$�$�L����*�*�*�*�4�4�4�4� � � � ������rEr c��eZdZdZdZdZ d!d"d �Zed#d���Zd$d%d�Z d&d�Z d'd�Z d(d�Z d$d)d�Z d*d�Z d+d,d �ZdS)-r�z�A :class:`_engine.Result` that gets data from a Python iterator of :class:`_engine.Row` objects or similar row-like data. .. versionadded:: 1.4 FNr�r-�iterator�(Iterator[_InterimSupportsScalarsRowType]�rawr�r�rHc�>�||_||_||_||_dSr@)r�r�r�r�)rBr�r�r�r�s rCr�zIteratorResult.__init__�s'��)��� �� ����(@��%�%�%rEr=c��|jS)z{Return ``True`` if this :class:`_engine.IteratorResult` has been closed .. versionadded:: 1.4.43 )� _hard_closedrAs rCr�zIteratorResult.closed�s ��� � rEr�kwrrYc ��|rd|_|j�|jjdd|i|��tg��|_|���d|_dS)NTrr.)r�r�rr�r��_reset_memoizationsr�)rBrr�s rCrzIteratorResult._soft_close�sg�� � %� $�D� � �8� � �D�H� � 1� 1�d� 1�b� 1� 1� 1��R���� � � � �"�"�"� ����rErc�*�tjd���)NzThis result object is closed.)r�ResourceClosedErrorrAs rC�_raise_hard_closedz!IteratorResult._raise_hard_closed�s���%�&E�F�F�FrEr�c��|jSr@)r�rAs rCr�z IteratorResult._raw_row_iterator�s ���}�rEc�F�|jr|���|jSr@)r�r�r�rAs rCrzIteratorResult._fetchiter_impl�s'�� � � &� � #� #� %� %� %��}�rErrc��|jr|���t|jt��}|tur|�|���dS|Sr%)r�r��nextr�r�r)rBrrs rCrzIteratorResult._fetchone_impl�s\�� � � &� � #� #� %� %� %��4�=�'�*�*�� �'�>�>� � � �*� � -� -� -��4��JrErc��|jr|��� t|j��|���S#|���wxYwr@)r�r�r�r�rrAs rCr zIteratorResult._fetchall_impl�s^�� � � &� � #� #� %� %� %� ��� �&�&� � � � � � � ��D� � � � � � ���s �A�Arrdc��|jr|���ttj|jd|����Sr�)r�r�r�� itertools�islicer�r s rCr zIteratorResult._fetchmany_impl�s@�� � � &� � #� #� %� %� %��I�$�T�]�A�t�<�<�=�=�=rEr�)r�r-r�r�r�r�r�rHrr��rrHr�rr=rY)r=rr)r=r�r�r�r@r�)r�r�r�r�r�r�r�r�r�rr�r�rrr r r.rErCr�r��s���������L��L� &*�).� A� A� A� A� A��!�!�!��X�!�!�!�!�!�!�G�G�G�G��������� "'� � � � � �����%)�>�>�>�>�>�>�>rEr��IteratorResult[Any]c�V�ttg��tg����Sr@)r�r�r�r.rErC� null_resultr��s!�� �.�r�2�2�D��H�H� =� =�=rEc�^��eZdZdZ ddd �Zedd���Zdd �fd� Z d!d"�fd� Z�xZ S)#�ChunkedIteratorResulta�An :class:`_engine.IteratorResult` that works from an iterator-producing callable. The given ``chunks`` argument is a function that is given a number of rows to return in each chunk, or ``None`` for all rows. The function should then return an un-consumed iterator of lists, each list of the requested size. The function can be called at any time again, in which case it should continue from the same result set but adjust the chunk size as given. .. versionadded:: 1.4 FNr�r-�chunks�BCallable[[Optional[int]], Iterator[Sequence[_InterimRowType[_R]]]]�source_supports_scalarsrHr�r��dynamic_yield_perc��||_||_||_||_tj�|�d����|_||_dSr@) r�r�r�r�r��chain� from_iterabler�r�)rBr�r�r�r�r�s rCr�zChunkedIteratorResult.__init__�sR��)����� �(?��%����!��5�5�d�k�k�$�6G�6G�H�H�� �!2����rErdrr=r$c��||_tj�|�|����|_|Sr@)rgr�r�r�r�r�r�s rCr�zChunkedIteratorResult.yield_per s3�����!��5�5�d�k�k�#�6F�6F�G�G�� �� rErr�rrYc �N��t��jdd|i|��d�|_dS)Nrc��gSr@r.r0s rC�<lambda>z3ChunkedIteratorResult._soft_close.<locals>.<lambda> s��2�rEr.)�superrr�)rBrr�r�s �rCrz!ChunkedIteratorResult._soft_close s2��������,�,��,��,�,�,�%�o�� � � rErrdrc����|jr7tj�|�|����|_t ���|���Sr/)r�r�r�r�r�r�r�r )rBrr�s �rCr z%ChunkedIteratorResult._fetchmany_impl sO��� � !� M�%�O�9�9�$�+�+�d�:K�:K�L�L�D�M��w�w�&�&�D�&�1�1�1rE)FNF) r�r-r�r�r�rHr�r�r�rHrr�r�r@r�) r�r�r�r�r�rr�rr � __classcell__�r�s@rCr�r��s�������� � �*).�%)�"'�3�3�3�3�3�"� � � ��[� �&�&�&�&�&�&�&� %)�2�2�2�2�2�2�2�2�2�2�2rEr�c�>��eZdZUdZdZded<d�fd � Zddd�Z�xZS)rz�A :class:`_engine.Result` that is merged from any number of :class:`_engine.Result` objects. Returned by the :meth:`_engine.Result.merge` method. .. versionadded:: 1.4 Frd�rowcountr�r-�results�Sequence[Result[_TP]]c�P��||_t���|tj�d�|D������|dj|_|dj|_|dj|_|j j d�|D���|_ dS)Nc3�>K�|]}|���V��dSr@)r��r��rs rCr_z(MergedResult.__init__.<locals>.<genexpr>9 s?����*�*�*+��#�#�%�%�*�*�*�*�*�*rErc��g|] }|j�� Sr.)r�r�s rCr�z)MergedResult.__init__.<locals>.<listcomp>E s�� -� -� -��a�m� -� -� -rE) �_resultsr�r�r�r�r�r�rgr�r�� merge_with)rBr�r�r�s �rCr�zMergedResult.__init__3 s���� �� � ����� � �O� )� )�*�*�/6�*�*�*� � � � � �%,�A�J�$C��!�!�!�*�/���)0�� �(K��%�6�4�+�6� -� -�W� -� -� -� ����rErrHr�rr=rYc �N�|jD]}|jdd|i|���|r d|_dSdS)NrTr.)r�rr�)rBrr�r�s rCrzMergedResult._soft_closeH sP���� +� +�A� �A�M� *� *�t� *�r� *� *� *� *� � ��D�K�K�K� � rE)r�r-r�r�r�r�) r�r�r�r�r�r�r�rr�r�s@rCrr& su�����������F����� � � � � � �*��������rErr@)r�r7r�r�r=r�)r=r�)Xr�� __future__r�enumrr�r�ru�typingrrrrr r r r r rrrrrrrrrrrr�rr�sql.baserrrr r!� util._has_cyr"� util.typingr#r$�_py_rowr%�"sqlalchemy.cyextension.resultproxy� sql.schemar&� sql.type_apir'r��_KeyTyperrcr`r5�_RowData� _RawRowTyper(r*r+�_InterimRowType�_InterimSupportsScalarsRowType�_ProcessorsTypery�_UniqueFilterTyper�r-�KeysViewr>r�r�r�r�r�r�r�r r�� TypingOnlyrIr�r r�r�r�rr.rErC�<module>r�s^��,�+�"�"�"�"�"�"������������������� � � � ������������������������������������������������������������������������������������������� � � � � � �������������������������������������"�"�"�"�"�"�"�"�"�"�"�"�(�(�(�(�(�(�4�4�4�4�4�4�������*�*�*�*�*�*�!�!�!�!�!�!������� ��N��N�3�3�3�3�3�3�3�M�M�M�M�M�M� ��4�#�#�#�#�#�#�3�3�3�3�3�3� ��m�#� $���c�=�#�-�.� ����h��.�/� � ��S��:�s�*� +����C��H�o� �;� �W�T��"�"�"�� �W�T������ �g�e�5��c��?�+�+�+����K��(��� "'�s�3�x��}�!5���8�$?�@�A���X�c�]�O�X�c�]�:�;���c�U�C�Z�(���s�3�x��2C�)D�D�E��u$�u$�u$�u$�u$�u$�u$�u$�p)�)�)�)�)����$�)�)�)�DK�K�K�K�K�>�K�K�K�^37�����������T���� �.��S!�S!�S!�S!�S!�&��� �S!�S!�S!�l#�#�#�#�#�#�#�#�4g >�g >�g >�g >�g >�Y��s�3�x�0�g >�g >�g >�T]<�]<�]<�]<�]<�>�"�%�]<�]<�]<�@@ �@ �@ �@ �@ �<��#�@ �@ �@ �F`�`�`�`�`�,�r�"�D�O�`�`�`�FK �K �K �K �K �I�|�J�7�K �K �K �\M�M�M�M�M�7�3�<�M�M�M�`P>�P>�P>�P>�P>�V�C�[�P>�P>�P>�f>�>�>�>�62�62�62�62�62�N�3�/�62�62�62�r&�&�&�&�&�>�#�&�&�&�&�&�&rE
Memory