� k\�gx ��R �dZddlmZddlZddlmZddlZddlmZddlZddl Z ddl m Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd l mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl mZddl 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,d&d'l!m-Z-d&d(l!m.Z.d&d)l!m/Z/d&d*l/m0Z0d&d+l/m1Z1d&d,l/m Z2d&d-l3m4Z4d&d.l3m5Z5d&d/l3m6Z6er�dd0l!m7Z7dd1l!m8Z8dd2l!m9Z9dd3l:m;Z;dd4l:m<Z<dd5l=m>Z>dd6l8m?Z?dd7l8m@Z@dd8l8mAZAdd9l8mBZBdd:l8mCZCdd;l8mDZDdd<l8mEZEdd=lFmGZGdd>lFmHZHdd?lImJZJdd@lImKZKddAlImLZLd&dBlMmNZNd&dClMmOZOd&dDlPmQZQd&dElPmRZRd&dFlPmSZSd&dGlPmTZTd&dHlPmUZUd&dIlPmVZVd&dJlPmWZWd&dKlPmXZXd&dLlPmYZYd&dMlPmZZZd&dNl-m[Z[esdZ7dZ8dZ9GdO�dPe��Z\e\j]Z]GdQ�dRe��Z^e^j_Z`edSe �T��ZaedUe dVe f�T��ZbeececfZdGdW�dXe��ZeejfdY��ZgGdZ�d[e4��ZhGd\�d]e4��Zid�db�Zjedce �T��ZkGdd�de��ZlGdf�dgel��Zmd�dk�Znd�dn�Zoedodp�T��ZpGdq�dpe2j4��Zqd�ds�Zrd�dx�Zsdy�Ztd�d{�Zud�d|�Zvd�d��Zwd�d��ZxGd��d�eece f��ZyGd��d�eece f��Zze/j{d���d����Z|Gd��d���Z}Gd��d���Z~Gd��d�e0��ZGd��d�e0��Z�Gd��d�e��Z�Gd��d�e���Z�Gd��d�e�����Z�Gd��d�e�e%��Z�Gd��d�e(��Z�Gd��d�e"j���Z�Gd��d�e-j���Z�Gd��d�e)��Z�Gd��d�e��Z�Gd��d�e��Z�ed�e decfec��Z�ed�d�d�����Z�ed�d��T��Z�Gd��d�ee���Z�Gd��d�ee�e�f��Z�ed�d��T��Z�Gd��d�e�ece�f��Z�Gd��d�e/j�e�e�e�f��Z�Gd��d�e/j�d���Z�d�d��Z�e]fd�d��Z�dS)�z4Foundational utilities common to many sql modules. �)� annotationsN)�Enum�� zip_longest)�Any)�Callable)�cast)�Dict)� FrozenSet)�Generic)�Iterable)�Iterator)�List)�Mapping)�MutableMapping)� NamedTuple)�NoReturn)�Optional)�overload)�Sequence)�Set)�Tuple)�Type)� TYPE_CHECKING)�TypeVar)�Union�)�roles)�visitors)� HasCacheKey)�MemoizedHasCacheKey)�HasCopyInternals)� ClauseVisitor)�ExtendedInternalTraversal)�ExternallyTraversible)�InternalTraversal�)�event)�exc)�util)� HasMemoized)� hybridmethod)�typing)�Protocol)�Self)� TypeGuard)� coercions��elements)�type_api)�DMLStrategyArgument)�SynchronizeSessionArgument)�_CLE)� BindParameter)� ClauseList)� ColumnClause)� ColumnElement)� NamedColumn)�SQLCoreOperations)� TextClause)�Column)�DefaultGenerator)�_JoinTargetElement)�_SelectIterable)� FromClause)� Connection)� CursorResult)�_CoreMultiExecuteParams)�_ExecuteOptions)�_ImmutableExecuteOptions)� CacheStats)�Compiled)�CompiledCacheType)�CoreExecuteOptionsParameter)�Dialect)�IsolationLevel)�SchemaTranslateMapType)� dispatcherc��eZdZdZd�ZdS)�_NoArgrc��d|j��S)Nz_NoArg.)�name��selfs �c/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sqlalchemy/sql/base.py�__repr__z_NoArg.__repr__js��$���$�$�$�N)�__name__� __module__� __qualname__�NO_ARGrX�rYrWrRrRgs(������ �F�%�%�%�%�%rYrRc��eZdZdZdS)� _NoneNamerN)rZr[r\� NONE_NAMEr^rYrWr`r`qs�������I�H�HrYr`�_T)�bound�_Fn.c�P�eZdZUded<ded<ded<ded<ed d ���Zd S) �_DefaultDescriptionTupler�argzOptional[bool]� is_scalar� is_callable� is_sentinel�default�Optional[DefaultGenerator]�returnc��|r;|js|js-|jr&t|j|j|j|j��ntdddd��S�N)�has_arg� for_updaterjrfrgrhri)�clsrks rW�_from_column_defaultz-_DefaultDescriptionTuple._from_column_default�sw��� B��� B� �*� B�07�/B� B� $�� ��!��#��#�  � � �*�$��d�D�A�A� rYN)rkrlrmrf)rZr[r\�__annotations__� classmethodrsr^rYrWrfrfsa������� �H�H�H�������������� � � ��[� � � rYrf�_omit_from_statementsc��eZdZdd�ZdS)�_EntityNamespace�key�strrm�SQLCoreOperations[Any]c��dSror^�rVrys rW� __getattr__z_EntityNamespace.__getattr__�����rYN)ryrzrmr{)rZr[r\r~r^rYrWrxrx�s������B�B�B�B�B�BrYrxc�0�eZdZejdd���ZdS)�_HasEntityNamespacermrxc��dSror^rUs rW�entity_namespacez$_HasEntityNamespace.entity_namespace�s��47�CrYN)rmrx)rZr[r\r*�ro_non_memoized_propertyr�r^rYrWr�r��s*������ �"�7�7�7�#�"�7�7�7rYr��elementrrm�TypeGuard[_HasEntityNamespace]c�"�t|d��S)Nr�)�hasattr)r�s rW�_is_has_entity_namespacer��s�� �7�.� /� /�/rY�_Selfc�<�eZdZdZdZdZd�Zd�Zdd �Zdd �dd�Z dS)� Immutablea%mark a ClauseElement as 'immutable' when expressions are cloned. "immutable" objects refers to the "mutability" of an object in the context of SQL DQL and DML generation. Such as, in DQL, one can compose a SELECT or subquery of varied forms, but one cannot modify the structure of a specific table or column within DQL. :class:`.Immutable` is mostly intended to follow this concept, and as such the primary "immutable" objects are :class:`.ColumnClause`, :class:`.Column`, :class:`.TableClause`, :class:`.Table`. r^Tc� �td����Nz(Immutable objects do not support copying��NotImplementedError�rV� optionaldict�kwargss rW� unique_paramszImmutable.unique_params����!�"L�M�M�MrYc� �td���r�r�r�s rW�paramszImmutable.params�r�rYrVr��kwrrmc ��|Sror^�rVr�s rW�_clonezImmutable._clone�s��� rY)� omit_attrsr�� Iterable[str]�Nonec ��dSror^)rVr�r�s rW�_copy_internalszImmutable._copy_internals�s �� �rYN)rVr�r�rrmr�)r�r�r�rrmr�) rZr[r\�__doc__� __slots__� _is_immutabler�r�r�r�r^rYrWr�r��s������� � ��I��M�N�N�N�N�N�N�����.0� � � � � � � � rYr�c�b�eZdZUdZdZded<dd �Zejdd ���Z e d ���Z dS)�SingletonConstantz.Represent SQL constants like NULL, TRUE, FALSET� _singletonrrrbrgrr�rmc�6�tt|j��Sro)r rbr�)rrrgr�s rW�__new__zSingletonConstant.__new__�s���B���'�'�'rY�FrozenSet[ColumnElement[Any]]c��t���ror�rUs rW� proxy_setzSingletonConstant.proxy_set����!�#�#�#rYc��t�|��}|���t|g��|_||_dSro)�objectr��__init__� frozensetr�r�)rr�objs rW�_create_singletonz#SingletonConstant._create_singleton�s>���n�n�S�!�!�� � � ����"�3�%�(�(�� �����rYN)rrrbrgrr�rrmrb)rmr�) rZr[r\r��_is_singleton_constantrtr�r*�non_memoized_propertyr�rur�r^rYrWr�r��s��������8�8�!��!�!�!�!�(�(�(�(� ��$�$�$� ��$�� � ��[� � � rYr�r3�EUnion[ColumnElement[Any], FromClause, TextClause, _JoinTargetElement]�Iterator[FromClause]c�T�tj�d�|D����S)Nc��g|] }|j�� Sr^)� _from_objects)�.0r�s rW� <listcomp>z!_from_objects.<locals>.<listcomp>�s��7�7�7�7�� �7�7�7rY�� itertools�chain� from_iterabler2s rWr�r��s/�� �?� (� (�7�7�h�7�7�7� � �rY�!Iterable[roles.ColumnsClauseRole]rBc�T�tj�d�|D����S)zXexpand tables into individual columns in the given list of column expressions. c��g|] }|j�� Sr^)�_select_iterable�r��cs rWr�z%_select_iterables.<locals>.<listcomp>�s��.�.�.��� �.�.�.rYr�r2s rW�_select_iterablesr��s/�� �?� (� (�.�.�X�.�.�.� � �rY�_SelfGenerativeType�_GenerativeTypec��eZdZdd�ZdS)r�rmr/c��dSror^rUs rW� _generatez_GenerativeType._generaterrYN�rmr/)rZr[r\r�r^rYrWr�r�s������$�$�$�$�$�$rY�fnc�V�tjd d ���}||��}||_|S) z�non-caching _generative() decorator. This is basically the legacy decorator that copies the object and runs a method on the new copy. r�rdrVr��argsrr�rmc�b�|���}||g|�Ri|��}||us Jd���|S)zMark a method as generative.z#generative methods must return self)r�)r�rVr�r��xs rW� _generativez _generative.<locals>._generativesK�� �~�~���� �B�t� !�d� !� !� !�b� !� !���D�y�y�y�?�y�y�y�� rY) r�rdrVr�r�rr�rrmr�)r*� decorator�non_generative)r�r�� decorateds rWr�r�sA�� �^�����^��� �B���I�!�I�� �rY�namesrzr��Callable[[_Fn], _Fn]c�����|�di���|�di����fd�|D���tj��fd���}|S)N�msgs�defaultsc�f��g|]-}|tj|����|d��f��.Sro)�operator� attrgetter�get)r�rTr�s �rWr�z&_exclusive_against.<locals>.<listcomp>%sI������ � �x�"�4�(�(�(�,�,�t�T�*B�*B�C���rYc ����|d}|dd�}�D]N\}}}||��|ur;� �|d|j�d|j�d���}tj|����O||g|�Ri|��S)NrrzMethod z$() has already been invoked on this z construct)r�rZ� __class__r)�InvalidRequestError) r�r�r�rVrT�getter�default_�msg�gettersr�s ��rW�checkz!_exclusive_against.<locals>.check*s�����A�w���A�B�B�x��&-� 3� 3� "�D�&�(��v�d�|�|�8�+�+��h�h��D��{�{�{�D�N�N�N�4���� �-�c�2�2�2� ,��r�$�$��$�$�$��$�$�$rY)�popr*r�)r�r�r�r�r�r�s @@@rW�_exclusive_againstr� s������ �6�6�&�"� � �D��v�v�j�"�%�%�H���������G�  �^� %� %� %� %� %��^� %� �LrYc ��|jdi|��S�Nr^)r�)r�r�s rWr�r�=s�� �7�>� � �B� � �rY�Iterable[_CLE]c�2�tjd�|D���S)z\expand the given set of ClauseElements to be the set of all 'cloned' predecessors. c��g|] }|j�� Sr^)� _cloned_set�r�r�s rWr�z"_expand_cloned.<locals>.<listcomp>Is��=�=�=�q�Q�]�=�=�=rY)r�r�r2s rW�_expand_clonedr�As �� �?�=�=�H�=�=�=� >�>rYc#�FK�|D]}|j�|j}|j�|V��dSro)� _is_clone_of)r3r�s rW� _de_cloner�LsE���������n�(���A��n�(�������rY�a�b� Set[_CLE]c���tt|�����t|������fd�|D��S)z�return the intersection of sets a and b, counting any overlap between 'cloned' predecessors. The returned set is in terms of the entities present within 'a'. c�H��h|]}��|j���|��Sr^�� intersectionr��r��elem� all_overlaps �rW� <setcomp>z'_cloned_intersection.<locals>.<setcomp>]s/��� M� M� M�T�+�":�":�4�;K�"L�"L� M�D� M� M� MrY��setr�r��r�r�r�s @rW�_cloned_intersectionrUsJ����n�Q�'�'�(�(�5�5�n�Q�6G�6G�H�H�K� M� M� M� M�Q� M� M� M�MrYc���tt|�����t|������fd�|D��S)Nc�H��h|]}��|j���|��Sr^r�r�s �rWr�z%_cloned_difference.<locals>.<setcomp>bs?��� � � ��+�":�":�4�;K�"L�"L� � � � � rYr�rs @rW�_cloned_differencer`sY����n�Q�'�'�(�(�5�5�n�Q�6G�6G�H�H�K� � � � �� � � �rYc�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z d S) �_DialectArgViewzaA dictionary view of dialect-level arguments in the form <dialectname>_<argument_name>. c��||_dSro)r�)rVr�s rWr�z_DialectArgView.__init__ms ������rYc�� |�dd��\}}||fS#t$r}t|��|�d}~wwxYw)N�_r)�split� ValueError�KeyError)rVry�dialect� value_key�errs rW�_keyz_DialectArgView._keyps[�� &�!$���3��!2�!2� �G�Y��I�%� %��� )� )� )��3�-�-�S� (����� )���s�� >�9�>c��|�|��\}} |jj|}||S#tj$r}t |��|�d}~wwxYwro)rr��dialect_optionsr)�NoSuchModuleErrorr )rVryrr�optrs rW� __getitem__z_DialectArgView.__getitem__xsh��!�Y�Y�s�^�^���� "��(�*�7�3�C��y�>� !���$� )� )� )��3�-�-�S� (����� )���s�4�A�A�Ac�� |�|��\}}||jj||<dS#t$r}t jd��|�d}~wwxYw)Nz0Keys must be of the form <dialectname>_<argname>)rr�rr r)� ArgumentError)rVry�valuerrrs rW� __setitem__z_DialectArgView.__setitem__�su�� A�!%���3��� �G�Y� <A�D�H� $�W� -�i� 8� 8� 8�� � � � ��#�B���� ����� ���s�1� A�A�Ac�\�|�|��\}}|jj||=dSro)rr�r)rVryrrs rW� __delitem__z_DialectArgView.__delitem__�s.��!�Y�Y�s�^�^���� �H� $�W� -�i� 8� 8� 8rYc�l�td�|jj���D����S)Nc3�>K�|]}t|j��V��dSro)�len� _non_defaults)r�r�s rW� <genexpr>z*_DialectArgView.__len__.<locals>.<genexpr>�sA���� � �� ��"� #� #� � � � � � rY)�sumr�r�valuesrUs rW�__len__z_DialectArgView.__len__�sA��� � ���0�7�7�9�9� � � � � � rYc�4���fd��jjD��S)Nc3�Z�K�|]%}�jj|jD] }|�d|��V�� �&dS)r N)r�rr )r�� dialect_name� value_namerVs �rWr!z+_DialectArgView.__iter__.<locals>.<genexpr>�si����� � ��"�h�6����  � ��$�|�|�Z�Z� 0� � � � � � � rY)r�rrUs`rW�__iter__z_DialectArgView.__iter__�s3��� � � � � $�� 8� � � � rYN) rZr[r\r�r�rrrrr$r)r^rYrWrrgs��������� ���&�&�&�"�"�"�A�A�A�9�9�9� � � �  � � � � rYrc�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z dS) �_DialectArgDictz�A dictionary view of dialect-level arguments for a specific dialect. Maintains a separate collection of user-specified arguments and dialect-specified default arguments. c�"�i|_i|_dSro�r � _defaultsrUs rWr�z_DialectArgDict.__init__�s���������rYc�t�tt|j���|j����Sro)rrr �unionr.rUs rWr$z_DialectArgDict.__len__�s+���3�t�)�*�*�0�0���@�@�A�A�ArYc�t�tt|j���|j����Sro)�iterrr r0r.rUs rWr)z_DialectArgDict.__iter__�s+���C��*�+�+�1�1�$�.�A�A�B�B�BrYc�H�||jvr |j|S|j|Sror-r}s rWrz_DialectArgDict.__getitem__�s+�� �$�$� $� $��%�c�*� *��>�#�&� &rYc��||j|<dSro�r �rVryrs rWrz_DialectArgDict.__setitem__�s��"'���3���rYc��|j|=dSror5r}s rWrz_DialectArgDict.__delitem__�s�� � �s� #� #� #rYN) rZr[r\r�r�r$r)rrrr^rYrWr+r+�s~�����������B�B�B�C�C�C�'�'�'� (�(�(�$�$�$�$�$rYr+zsqlalchemy.dialectsc��tjjj�|��}|j�dSt |j��Sro)r*� preloaded�dialects�registry�load�construct_arguments�dict)r'� dialect_clss rW�_kw_reg_for_dialectr@�s<���.�)�2�7�7� �E�E�K��&�.��t� � �/� 0� 0�0rYc���eZdZdZdZdejfgZed���Z e j d���Z e d���Ze je��Zd�Ze j d���Zdd �ZdS)� DialectKWArgsa9Establish the ability for a class to have dialect-specific arguments with defaults and constructor validation. The :class:`.DialectKWArgs` interacts with the :attr:`.DefaultDialect.construct_arguments` present on a dialect. .. seealso:: :attr:`.DefaultDialect.construct_arguments` r^rc��tj|}|�tjd|z���||vri||<||||<dS)a_Add a new kind of dialect-specific keyword argument for this class. E.g.:: Index.argument_for("mydialect", "length", None) some_index = Index("a", "b", mydialect_length=5) The :meth:`.DialectKWArgs.argument_for` method is a per-argument way adding extra arguments to the :attr:`.DefaultDialect.construct_arguments` dictionary. This dictionary provides a list of argument names accepted by various schema-level constructs on behalf of a dialect. New dialects should typically specify this dictionary all at once as a data member of the dialect class. The use case for ad-hoc addition of argument names is typically for end-user code that is also using a custom compilation scheme which consumes the additional arguments. :param dialect_name: name of a dialect. The dialect must be locatable, else a :class:`.NoSuchModuleError` is raised. The dialect must also include an existing :attr:`.DefaultDialect.construct_arguments` collection, indicating that it participates in the keyword-argument validation and default system, else :class:`.ArgumentError` is raised. If the dialect does not include this collection, then any keyword argument can be specified on behalf of this dialect already. All dialects packaged within SQLAlchemy include this collection, however for third party dialects, support may vary. :param argument_name: name of the parameter. :param default: default value of the parameter. NzRDialect '%s' does have keyword-argument validation and defaults enabled configured)rB� _kw_registryr)r)rrr'� argument_namerk�construct_arg_dictionarys rW� argument_forzDialectKWArgs.argument_for�sk��L$1�#=�l�#K� � #� +��#�=�?K�L��� � �.� .� .�,.� $�S� )�7>� ��%�m�4�4�4rYc� �t|��S)a�A collection of keyword arguments specified as dialect-specific options to this construct. The arguments are present here in their original ``<dialect>_<kwarg>`` format. Only arguments that were actually passed are included; unlike the :attr:`.DialectKWArgs.dialect_options` collection, which contains all options known by this dialect including defaults. The collection is also writable; keys are accepted of the form ``<dialect>_<kwarg>`` where the value will be assembled into the list of options. .. seealso:: :attr:`.DialectKWArgs.dialect_options` - nested dictionary form )rrUs rW�dialect_kwargszDialectKWArgs.dialect_kwargs s��&�t�$�$�$rYc��|jS)z4A synonym for :attr:`.DialectKWArgs.dialect_kwargs`.)rIrUs rWr�zDialectKWArgs.kwargs s ���"�"rYc��tj|}t��}|�|j�ddi��n@t |jj��D]&}||vr |j�||���'|S)N�*)rBrDr+r.�update�reversedr��__mro__)rVr'rF�drrs rW�_kw_reg_for_dialect_clsz%DialectKWArgs._kw_reg_for_dialect_cls's���#0�#=�l�#K� � � � �� #� +� �K� � ��T�{� +� +� +� +���� 6�7�7� F� F���2�2�2��K�&�&�'?��'D�E�E�E���rYc�X�tjtj|j����S)a�A collection of keyword arguments specified as dialect-specific options to this construct. This is a two-level nested registry, keyed to ``<dialect_name>`` and ``<argument_name>``. For example, the ``postgresql_where`` argument would be locatable as:: arg = my_object.dialect_options["postgresql"]["where"] .. versionadded:: 0.9.2 .. seealso:: :attr:`.DialectKWArgs.dialect_kwargs` - flat dictionary form )r*� PopulateDict�portable_instancemethodrQrUs rWrzDialectKWArgs.dialect_options3s*��&� � � (��)E� F� F� � � rYr��Dict[str, Any]rmr�c ��|sdS|D]�}tjd|��}|std|z���|�dd��\}} |j|}d|vr&||vr"t jd|�d|�d|j�����||||<��#t j$ratj d |�d |����t��x|j|<}|j � ddi��|||j|<Y��wxYwdS) Nz ^(.+?)_(.+)$zGAdditional arguments should be named <dialectname>_<argument>, got '%s'rr'rLz Argument z is not accepted by dialect z on behalf of zCan't validate argument z,; can't locate any SQLAlchemy dialect named )�re�match� TypeError�grouprr)rr�rr*�warnr+r.rMr )rVr��k�mr'�arg_namerFrPs rW�_validate_dialect_kwargsz&DialectKWArgs._validate_dialect_kwargsJs���� � �F�� C� C�A�����+�+�A�� ��?�AB�C����&'�W�W�Q��]�]� "�L�(� C�+/�+?� �+M�(��7�7�7� �(@�@�@��+�+��1�1�l�l�l�D�N�N�<���� :@���,�X�6�6��)�(� 6� 6� 6�� � ��q�q�,�,�(���� :I�9J�9J�J��$�\�2�Q�� �"�"�C��;�/�/�/�,2�1�I����)�)�)� 6���� C� Cs� B�A-C?�>C?N)r�rUrmr�)rZr[r\r�r�r&�dp_dialect_options�"_dialect_kwargs_traverse_internalsrurGr*�memoized_propertyrI�propertyr�rSr@rDrQrr_r^rYrWrBrB�s������� � ��I� �-�@�A�*�&��-?�-?��[�-?�^ ��%�%���%�(�#�#��X�#�%�4�$�%8�9�9�L� � � � �� � ��� �,%C�%C�%C�%C�%C�%CrYrBc��eZdZUdZdZiZded<ded<ed���Zd�Z edd ���Z edd���Z edd���Z dS)� CompileStateaProduces additional object state necessary for a statement to be compiled. the :class:`.CompileState` class is at the base of classes that assemble state for a particular statement object that is then used by the compiler. This process is essentially an extension of the process that the SQLCompiler.visit_XYZ() method takes, however there is an emphasis on converting raw user intent into more organized structures rather than producing string output. The top-level :class:`.CompileState` for the statement being executed is also accessible when the execution context works with invoking the statement and collecting results. The production of :class:`.CompileState` is specific to the compiler, such as within the :meth:`.SQLCompiler.visit_insert`, :meth:`.SQLCompiler.visit_select` etc. methods. These methods are also responsible for associating the :class:`.CompileState` with the :class:`.SQLCompiler` itself, if the statement is the "toplevel" statement, i.e. the outermost SQL statement that's actually being executed. There can be other :class:`.CompileState` objects that are not the toplevel, such as when a SELECT subquery or CTE-nested INSERT/UPDATE/DELETE is generated. .. versionadded:: 1.4 )� statement�_ambiguous_table_name_mapz)Dict[Tuple[str, str], Type[CompileState]]�pluginsz Optional[_AmbiguousTableNameMap]rgc ��|jrT|j�dd��}|j�||jfd��}|�|jd|jf}n|jd|jf}||ur |||fi|��S|j||fi|��S�N�compile_state_pluginrk)�_propagate_attrsr�rh�_effective_plugin_target�create_for_statement)rrrf�compilerr�� plugin_name�klasss rWrnz!CompileState.create_for_statement�s��� � %� �#�4�8�8�&� ���K��K�O�O��i�@�A�4���E��}�� �� � B�C���� �K��I�>�?��E� �C�<�<��3�y�(�1�1�b�1�1� 1�-�5�-�i��H�H�R�H�H� HrYc ��||_dSro)rf)rVrfror�s rWr�zCompileState.__init__�s ��"����rYrf� Executablerm�Optional[Type[CompileState]]c���|j�dd��}|r||jf}||jvr |j|S |jd|jfS#t$rYdSwxYwrj)rlr�rmrhr )rrrfrprys rW�get_plugin_classzCompileState.get_plugin_class�s��� �0�4�4� "�D� � � � � (�� � B�C�C��c�k�!�!��{�3�'�'�  ��;� �9�+M�N�O� O��� � � ��4�4� ���s�A� A �A rprzc�N� |j||jfS#t$rYdSwxYwro)rhrmr )rrrfrps rW�_get_plugin_class_for_pluginz)CompileState._get_plugin_class_for_plugin�sE�� ��;��i�@�A�� ��� � � ��4�4� ���s �� $�$� visit_namer�c��������fd�}|S)Nc� ��|�j��f<|Sro)rh)�cls_to_decoraterrrprys ���rW�decoratez)CompileState.plugin_for.<locals>.decorate�s���5D�C�K��j�1� 2�"� "rYr^)rrrpryr}s``` rW� plugin_forzCompileState.plugin_for�s/����� #� #� #� #� #� #� #��rYN)rfrsrmrt)rfrsrprzrmrt)rprzryrzrmr�) rZr[r\r�r�rhrtrurnr�rvrxr~r^rYrWrerers����������4;�I�9;�G�;�;�;�;�?�?�?�?��I�I��[�I�2#�#�#������[��*�����[�������[���rYrec��eZdZdZdd�ZdS)� GenerativezUProvide a method-chaining pattern in conjunction with the @_generative decorator.rmr/c���|j�|j}|�|��}�r=�fd�|j������D��|_n|j���|_|S)Nc�$��i|] \}}|�v� ||�� Sr^r^)r�r\�v�skips �rW� <dictcomp>z(Generative._generate.<locals>.<dictcomp>�s+��������A��$����1���rY)�_memoized_keysr�r��__dict__�copy�items)rVrr�sr�s @rWr�zGenerative._generate�s�����"���n�� �K�K�� � �� � .�����!%��!3�!3�!5�!5�!;�!;�!=�!=����A�J�J���+�+�-�-�A�J��rYNr�)rZr[r\r�r�r^rYrWr�r��s2�������� � � � � � rYr�c��eZdZdZdZd�ZdS)�InPlaceGenerativezkProvide a method-chaining pattern in conjunction with the @_generative decorator that mutates in place.r^c�T�|j}|D]}|j�|d���|Sro)r�r�r�)rVr�r\s rWr�zInPlaceGenerative._generate�s9���"��� '� '�A� �M� � �a�� &� &� &� &�� rYN)rZr[r\r�r�r�r^rYrWr�r��s4������5�5��I�����rYr�c�H�eZdZUdZdZded<ejZded<e j Z dS)�HasCompileStatez=A class that has a :class:`.CompileState` associated with it.Nrt�_compile_state_plugin�util.immutabledict[str, Any]� _attributes) rZr[r\r�r�rtr*� EMPTY_DICTr�rern�_compile_state_factoryr^rYrWr�r��sF�������G�G�:>��>�>�>�>�04��K�?�?�?�?�)�>���rYr�c�D�eZdZUdZded<d�Zerdd �Zdd �Zdd �Z dSdS)� _MetaOptionsz�metaclass for the Options class. This metaclass is actually necessary despite the availability of the ``__init_subclass__()`` hook as this type also provides custom class-level behavior for the ``__add__()`` method. �Tuple[str, ...]� _cache_attrsc��|��}t|���|j��r:td|�dt|���|j�������|j�|��|S�Nz<dictionary contains attributes not covered by Options class z: )r� differencer�rYr�rM�rV�other�o1s rW�__add__z_MetaOptions.__add__s��� �T�V�V�� �u�:�:� � ��!2� 3� 3� ��)��4�4��U���.�.�t�/@�A�A�A�C��� � � ���5�!�!�!�� rYryrzrmrc��dSror^r}s rWr~z_MetaOptions.__getattr__ rrYrr�c��dSror^r6s rW� __setattr__z_MetaOptions.__setattr__"rrYc��dSror^r}s rW� __delattr__z_MetaOptions.__delattr__$rrYN�ryrzrmr�ryrzrrrmr��ryrzrmr�) rZr[r\r�rtr�rr~r�r�r^rYrWr�r�sq���������"�!�!�!� � � ��5�3�3�3�3�@�@�@�@�4�4�4�4�4�4� 5�5rYr�c���eZdZUdZdZded<d�fd� Zd�Zd �Zd �Z d �Z e d d���Z e d���Ze d!d���ZejZded<ejd!d���Ze d���Ze d���Zerd"d�Zd#d�Zd$d�Z�xZS�xZS)%�Optionsz,A cacheable option dictionary with defaults.r^r�r�rmr�c���|j}ttd�|D������|_t �����dS)Nc3�LK�|]}|�d��s|dv�|V�� dS)�__)�_cache_key_traversalN)� startswith)r�rPs rWr!z,Options.__init_subclass__.<locals>.<genexpr>1sR��������|�|�D�)�)���6�6�6��7�6�6�6� �rY)r��tuple�sortedr��super�__init_subclass__)rr�dict_r�s �rWr�zOptions.__init_subclass__.sc���� �� � ������� � � � ��� ���!�!�#�#�#�#�#rYc �:�|j�|��dSro)r�rMr�s rWr�zOptions.__init__:s�� � ���R� � � � � rYc�x�|j�|j��}|j�|j��t |���|j��r:td|�dt |���|j�������|j�|��|Sr�)r�r�r�rMrr�r�rYr�s rWr�zOptions.__add__=s��� �^� #� #�D�N� 3� 3�� � ���4�=�)�)�)� �u�:�:� � ��!2� 3� 3� ��)��4�4��U���.�.�t�/@�A�A�A�C��� � � ���5�!�!�!�� rYc��t|j|j��D]*\}}t||��t||��krdS�+dS�NFT)rr��getattr)rVr�r�r�s rW�__eq__zOptions.__eq__KsW�� �� 1�5�3E�F�F� � �D�A�q��t�Q���7�5�!�#4�#4�4�4��u�u�5��trYc�p���jj�dd��fd��jD�����d�S)N�(�, c3�N�K�|]}|�jv� |�d�j|��V�� dS)�=N�r�)r�r\rVs �rWr!z#Options.__repr__.<locals>.<genexpr>XsO���������� �%�%��1�1�d�m�A�.�.�/�%�%�%�%��rY�))r�rZ�joinr�rUs`rWrXzOptions.__repr__Ssa��� �N� #� #� #� �I�I������*���� � � � � � rYrq� Type[Any]�boolc�"�t||��Sro)� issubclass)rrrqs rW� isinstancezOptions.isinstance_s���#�u�%�%�%rYc�2�||t||��|zizSro)r�)rVrTrs rW�add_to_elementzOptions.add_to_elementcs!���t�W�T�4�0�0�5�8�9�9�9rY�Mapping[str, Any]c��|jSror�rUs rW�_state_dict_instzOptions._state_dict_instgs ���}�rYr��_state_dict_constc��|jSro)r�)rrs rW� _state_dictzOptions._state_dictms ���$�$rYc �0�|���}||juru|jrnt|j���|j��rBt d|�d|�dt|j���|j�������||zS)Nzother element z is not empty, is not of type z+, and contains attributes not covered here )r�r�r�rr�rY)rrr�rPs rW� safe_mergezOptions.safe_mergeqs��� � � � � �� �u�� &� &��"� '��E�&�'�'�2�2�3�3C�D�D� '��)��E�E��C�C���*�+�+�6�6�s�7G�H�H�H� ��� ��Q�w�rYc�^�|�t|���|����}|�||��}|r]i}|D]&}d|z} ||vr |||| <�||vr |||| <�'||z} t j���||| i��}| |fS||fS)a-process Options argument in terms of execution options. e.g.:: ( load_options, execution_options, ) = QueryContext.default_load_options.from_execution_options( "_sa_orm_load_options", {"populate_existing", "autoflush", "yield_per"}, execution_options, statement._execution_options, ) get back the Options and refresh "_sa_orm_load_options" in the exec options dict w/ the Options as well r )r�rr0r�r*� immutabledict� merge_with) rrry�attrs� exec_options�statement_exec_options�check_argnames�existing_options�result�argname�local� new_optionss rW�from_execution_optionszOptions.from_execution_options�s���4�+�+� � � � � #� #�$:� ;� ;� � ��(�+�+�C��5�5�� � 2��F�)� D� D���g� ���l�*�*�$0��$9�F�5�M�M�� 6�6�6�$:�7�$C�F�5�M��*�V�3�K��-�/�/�:�:��s�K�0���L�� �,� ,�$�\�1� 1rYryrzrc��dSror^r}s rWr~zOptions.__getattr__�rrYrc��dSror^r6s rWr�zOptions.__setattr__�rrYc��dSror^r}s rWr�zOptions.__delattr__�rrY)rmr�)rqr�rmr�)rmr�r�r�r�)rZr[r\r�r�rtr�r�r�r�rXrur�r,r�r�r*r�r�� classlevelr�r�r�rr~r�r�� __classcell__)r�s@rWr�r�'s���������6�6��I�!�!�!�!� $� $� $� $� $� $�!�!�!� � � ����  �  �  ��&�&�&��[�&��:�:��\�:������\��7;�o��E�E�E�E�� �%�%�%�!� �%�����[��0�/2�/2��[�/2�b�5�3�3�3�3�@�@�@�@�4�4�4�4�4�4�4�4� 5�5�5�5rYr�)� metaclassc�^�eZdZdZed���Zejd���Zed���ZdS)�CacheableOptionsr^c�.�tj|||��Sro)r �_gen_cache_key)rV�anon_map� bindparamss rW�_gen_cache_key_instz$CacheableOptions._gen_cache_key_inst�s���)�$��*�E�E�ErYc� �|dfSr�r^)rrr�r�s rWr�zCacheableOptions._gen_cache_key�s ���R�y�rYc�*�tj|��Sro)r �_generate_cache_key_for_objectrUs rW�_generate_cache_keyz$CacheableOptions._generate_cache_key�s���9�$�?�?�?rYN) rZr[r\r�r,r�r�r�r�r^rYrWr�r��st�������I��F�F��\�F��#���$�#���@�@��\�@�@�@rYr�c�2�eZdZdZejZdZdZdZ d�Z dS)�ExecutableOptionr^�executable_optionFTc �v�|j�|j��}t|j��|_|S)z/Create a shallow copy of this ExecutableOption.)r�r�r>r�)rVr�r�s rWr�zExecutableOption._clone�s/�� �N� "� "�4�>� 2� 2���$�-�(�(�� ��rYN) rZr[r\r�r*r�� _annotations�__visit_name__�_is_has_cache_key�_is_corer�r^rYrWr�r��s?�������I��?�L�(�N����H�����rYr�c���eZdZUdZdZded<ejZded<dZ dZ d ed <dZ d ed <d ed<d e j fd ejfdejfgZdZdZdZdZdZdZdZerded<ddd�dTd!�ZdUd)�ZdVd*�Zejd+���ZedWd,���Z e!dXd0���Z"e!dYd3���Z#e!dZd4���Z$e!d[d8���Z%e&d9d9d9ddd9d9d9d9ddd9d9d9d9d9dd:�d\dO���Z'e&d]dP���Z'e!d^dQ���Z'd_dS�Z(dS)`rsz�Mark a :class:`_expression.ClauseElement` as supporting execution. :class:`.Executable` is a superclass for all "statement" types of objects, including :func:`select`, :func:`delete`, :func:`update`, :func:`insert`, :func:`text`. Tr��supports_executionrH�_execution_optionsFr^zTuple[ExecutableOption, ...]� _with_optionsz6Tuple[Tuple[Callable[[CompileState], None], Any], ...]�_with_context_optionsz9Optional[Union[Type[CacheableOptions], CacheableOptions]]�_compile_optionsrlrzr�N)�for_executemany�schema_translate_maprrM�compiled_cache�Optional[CompiledCacheType]� column_keys� List[str]r�r�� Optional[SchemaTranslateMapType]r�rrm�CTuple[Compiled, Optional[Sequence[BindParameter[Any]]], CacheStats]c ��dSror^)rVrr�rr�r�r�s rW�_compile_w_cachezExecutable._compile_w_cache s �� �3rY� connectionrD�distilled_paramsrF�execution_optionsrL�CursorResult[Any]c��dSror^�rVrrr s rW�_execute_on_connectionz!Executable._execute_on_connections �� !$�rYc��dSror^r s rW�_execute_on_scalarzExecutable._execute_on_scalar!s �� �#rYc��t���ror�rUs rW�_all_selected_columnsz Executable._all_selected_columns(r�rYc��|jSro)r�rUs rWrmz#Executable._effective_plugin_target,s ���"�"rY�optionsr�r/c�T�|xjtd�|D����z c_|S)aJApply options to this statement. In the general sense, options are any kind of Python object that can be interpreted by the SQL compiler for the statement. These options can be consumed by specific dialects or specific kinds of compilers. The most commonly known kind of option are the ORM level options that apply "eager load" and other loading behaviors to an ORM query. However, options can theoretically be used for many other purposes. For background on specific kinds of options for specific kinds of statements, refer to the documentation for those option objects. .. versionchanged:: 1.4 - added :meth:`.Executable.options` to Core statement objects towards the goal of allowing unified Core / ORM querying capabilities. .. seealso:: :ref:`loading_columns` - refers to options specific to the usage of ORM queries :ref:`relationship_loader_options` - refers to options specific to the usage of ORM queries c3�TK�|]#}tjtj|��V��$dSro)r1�expectr�ExecutableOptionRole)r�rs rWr!z%Executable.options.<locals>.<genexpr>NsF����$ �$ �� � �U�7�� =� =�$ �$ �$ �$ �$ �$ rY)r�r��rVrs rWrzExecutable.options0sG��< ���e�$ �$ ��$ �$ �$ � � � ���� rY�compile_optionsr�c��||_|S)z|Assign the compile options to a new value. :param compile_options: appropriate CacheableOptions structure �r�)rVrs rW�_set_compile_optionszExecutable._set_compile_optionsTs��!0���� rYc�8�|j�J�|xj|z c_|S)z*update the _compile_options with new keys.rrs rW�_update_compile_optionsz"Executable._update_compile_options_s,���$�0�0�0� ����(���� rY� callable_�Callable[[CompileState], None]� cache_argsc�,�|xj||ffz c_|S)aMAdd a context option to this statement. These are callable functions that will be given the CompileState object upon compilation. A second argument cache_args is required, which will be combined with the ``__code__`` identity of the function itself in order to produce a cache key. )r�)rVrr!s rW�_add_context_optionzExecutable._add_context_optiongs%�� �"�"� �:�'>�&@�@�"�"�� rY.)r�� logging_token�isolation_level� no_parameters�stream_results�max_row_buffer� yield_per�insertmanyvalues_page_sizer��populate_existing� autoflush�synchronize_session� dml_strategy� render_nulls�is_delete_using�is_update_from�preserve_rowcountr$r%rNr&r'r(�intr)r*r+r,r-r6r.r5r/r0r1r2rc ��dSror^)rVr�r$r%r&r'r(r)r*r�r+r,r-r.r/r0r1r2rs rWr zExecutable.execution_optionszs ��,�srYc ��dSror^)rVrs rWr zExecutable.execution_options�s��58�SrYc ��d|vrtjd���d|vrtjd���|j�|��|_|S)a�Set non-SQL options for the statement which take effect during execution. Execution options can be set at many scopes, including per-statement, per-connection, or per execution, using methods such as :meth:`_engine.Connection.execution_options` and parameters which accept a dictionary of options such as :paramref:`_engine.Connection.execute.execution_options` and :paramref:`_orm.Session.execute.execution_options`. The primary characteristic of an execution option, as opposed to other kinds of options such as ORM loader options, is that **execution options never affect the compiled SQL of a query, only things that affect how the SQL statement itself is invoked or how results are fetched**. That is, execution options are not part of what's accommodated by SQL compilation nor are they considered part of the cached state of a statement. The :meth:`_sql.Executable.execution_options` method is :term:`generative`, as is the case for the method as applied to the :class:`_engine.Engine` and :class:`_orm.Query` objects, which means when the method is called, a copy of the object is returned, which applies the given parameters to that new copy, but leaves the original unchanged:: statement = select(table.c.x, table.c.y) new_statement = statement.execution_options(my_option=True) An exception to this behavior is the :class:`_engine.Connection` object, where the :meth:`_engine.Connection.execution_options` method is explicitly **not** generative. The kinds of options that may be passed to :meth:`_sql.Executable.execution_options` and other related methods and parameter dictionaries include parameters that are explicitly consumed by SQLAlchemy Core or ORM, as well as arbitrary keyword arguments not defined by SQLAlchemy, which means the methods and/or parameter dictionaries may be used for user-defined parameters that interact with custom code, which may access the parameters using methods such as :meth:`_sql.Executable.get_execution_options` and :meth:`_engine.Connection.get_execution_options`, or within selected event hooks using a dedicated ``execution_options`` event parameter such as :paramref:`_events.ConnectionEvents.before_execute.execution_options` or :attr:`_orm.ORMExecuteState.execution_options`, e.g.:: from sqlalchemy import event @event.listens_for(some_engine, "before_execute") def _process_opt(conn, statement, multiparams, params, execution_options): "run a SQL function before invoking a statement" if execution_options.get("do_special_thing", False): conn.exec_driver_sql("run_special_function()") Within the scope of options that are explicitly recognized by SQLAlchemy, most apply to specific classes of objects and not others. The most common execution options include: * :paramref:`_engine.Connection.execution_options.isolation_level` - sets the isolation level for a connection or a class of connections via an :class:`_engine.Engine`. This option is accepted only by :class:`_engine.Connection` or :class:`_engine.Engine`. * :paramref:`_engine.Connection.execution_options.stream_results` - indicates results should be fetched using a server side cursor; this option is accepted by :class:`_engine.Connection`, by the :paramref:`_engine.Connection.execute.execution_options` parameter on :meth:`_engine.Connection.execute`, and additionally by :meth:`_sql.Executable.execution_options` on a SQL statement object, as well as by ORM constructs like :meth:`_orm.Session.execute`. * :paramref:`_engine.Connection.execution_options.compiled_cache` - indicates a dictionary that will serve as the :ref:`SQL compilation cache <sql_caching>` for a :class:`_engine.Connection` or :class:`_engine.Engine`, as well as for ORM methods like :meth:`_orm.Session.execute`. Can be passed as ``None`` to disable caching for statements. This option is not accepted by :meth:`_sql.Executable.execution_options` as it is inadvisable to carry along a compilation cache within a statement object. * :paramref:`_engine.Connection.execution_options.schema_translate_map` - a mapping of schema names used by the :ref:`Schema Translate Map <schema_translating>` feature, accepted by :class:`_engine.Connection`, :class:`_engine.Engine`, :class:`_sql.Executable`, as well as by ORM constructs like :meth:`_orm.Session.execute`. .. seealso:: :meth:`_engine.Connection.execution_options` :paramref:`_engine.Connection.execute.execution_options` :paramref:`_orm.Session.execute.execution_options` :ref:`orm_queryguide_execution_options` - documentation on all ORM-specific execution options r%z�'isolation_level' execution option may only be specified on Connection.execution_options(), or per-engine using the isolation_level argument to create_engine().r�zm'compiled_cache' execution option may only be specified on Connection.execution_options(), not per statement.)r)rr�r0r�s rWr zExecutable.execution_options�sr��P �� "� "��#�/��� � �r� !� !��#�H��� �#'�"9�"?�"?��"C�"C���� rYrGc��|jS)z�Get the non-SQL options which will take effect during execution. .. versionadded:: 1.3 .. seealso:: :meth:`.Executable.execution_options` )r�rUs rW�get_execution_optionsz Executable.get_execution_options s ���&�&rY)rrMr�rrrr�r�r�rr�rrmr)rrDrrFr rLrmr )rrDrrFr rLrmr�rmrz)rr�rmr/)rr�rmr/)rr�rmr/)rr r!rrmr/)&r�rr$rzr%rNr&r�r'r�r(r3r)r3r*r3r�rr+r�r,r�r-r6r.r5r/r�r0r�r1r�r2r�rrrmr/)rrrmr/)r�rrmr/)rmrG))rZr[r\r�r�rtr*r�r��_is_default_generatorr�r�r&�dp_executable_optionsr$�dp_with_context_options�dp_propagate_attrs�_executable_traverse_internals� is_select�is_from_statement� is_update� is_insert�is_text� is_delete�is_dmlrrr rr�rrcrmr�rrrr#rr r8r^rYrWrsrs�s���������� $��#�#�#�#�37�?��B�B�B�B�!��24�M�4�4�4�4� �� � � � �P�O�O�O� �+�A�B� #� %� =� � �6�I�J� &�"��I����I��I��G��I� �F�������%*�EI� � � � � � � $� $� $� $� � � � � �"�$�$�#�"�$��#�#�#��X�#��!�!�!��[�!�F�����[�������[�������[��$�7:� �*-�#�$�!��*-�AD�"'��:=�,/� � #�"�"'�'������X��.�8�8�8��X�8��t�t�t��[�t�l '� '� '� '� '� 'rYrsc�.�eZdZUdZded<d d �Zd d �Zd S) �SchemaEventTargetz�Base class for elements that are the targets of :class:`.DDLEvents` events. This includes :class:`.SchemaItem` as well as :class:`.SchemaType`. zdispatcher[SchemaEventTarget]�dispatch�parentr�rrmr�c ��dS)z0Associate with this SchemaEvent's parent object.Nr^�rVrIr�s rW� _set_parentzSchemaEventTarget._set_parent"rrYc ��|j�||��|j|fi|��|j�||��dSro)rH�before_parent_attachrL�after_parent_attachrKs rW�_set_parent_with_dispatchz+SchemaEventTarget._set_parent_with_dispatch%sU�� � �*�*�4��8�8�8�����&�&�2�&�&�&� � �)�)�$��7�7�7�7�7rYN)rIrGr�rrmr�)rZr[r\r�rtrLrPr^rYrWrGrGsV���������,�+�+�+�?�?�?�?�8�8�8�8�8�8rYrGc��eZdZdZddiZdS)� SchemaVisitorz/Define the visiting for ``SchemaItem`` objects.�schema_visitorTN)rZr[r\r��__traverse_options__r^rYrWrRrR-s!������9�9�,�d�3���rYrRc�*�eZdZdZdZdZdZdZdZdZ dS) � _SentinelDefaultCharacterization�none�unknown� clientside�sentinel_default� serverside�identity�sequenceN) rZr[r\�NONE�UNKNOWN� CLIENTSIDE�SENTINEL_DEFAULT� SERVERSIDE�IDENTITY�SEQUENCEr^rYrWrVrV3s2������ �D��G��J�)���J��H��H�H�HrYrVc�R�eZdZUdZded<dZded<dZded<ejZ ded <dS) �_SentinelColumnCharacterizationNzOptional[Sequence[Column[Any]]]�columnsFr�� is_explicit� is_autoincrV�default_characterization) rZr[r\rgrtrhrirVr^rjr^rYrWrfrf=sh�������/3�G�3�3�3�3��K������J�����(�-�������rYrf�_COLKEY�_COL_co�ColumnElement[Any]T)rc� covariant�_COLc�:�eZdZUdZded<dd�Zd�Zd �Zdd�ZdS)�_ColumnMetrics)�columnrlrr� collection�ColumnCollection[Any, _COL_co]�colc�t�||_|j}|r%|jD]}||�|���dSdSro)rr� _proxy_index�_expanded_proxy_set�add)rVrsru�pi�eps_cols rWr�z_ColumnMetrics.__init__Qs\���� �� $�� � &��2� &� &���7� ����%�%�%�%� &� &� &� &rYc��|jjSro)rrrxrUs rW�get_expanded_proxy_setz%_ColumnMetrics.get_expanded_proxy_set]s ���{�.�.rYc��|j}|sdS|jjD]6}|�|d��}|r|�|��|�|s||=�7dSro)rwrrrxr��discard)rVrsrzru�colsets rW�disposez_ColumnMetrics.dispose`su�� � $��� � �F��;�2� � �C��V�V�C��&�&�F�� %����t�$�$�$��!�&�!��s�G��  � rY� target_set�=Union[Set[ColumnElement[Any]], FrozenSet[ColumnElement[Any]]]rmr�c��|jj}|�|��D](}|�t |g����sdS�)dSr�)rrrxr�r�r�)rVr��expanded_proxy_set�ts rW�embeddedz_ColumnMetrics.embeddedks^�� "�[�<���&�&�'9�:�:� � �A�%�2�2�>�1�#�3F�3F�G�G� ��u�u� ��trYN)rsrtrurl)r�r�rmr�) rZr[r\r�rtr�r}r�r�r^rYrWrqrqLsj��������I��O�O�O� &� &� &� &�/�/�/� � � � � � � � � rYrqc��eZdZUdZdZded<ded<ded<d ed < d\d]d�Zejd��d^d���Z d_d�Z e d`d���Z dad�Z d`d�Zdbd�Zdcd�Zddd!�Zded#�Zedfd'���Zedgd*���Zedhd,���Zdid/�Zdjd1�Zdkd2�Zdld5�Zdmd7�Zed\dnd:���Zedod=���Z d\dpd@�ZdqdA�ZdrdD�ZdsdE�ZdtdG�ZdudH�ZdvdJ�ZdwdK�Z d Z!d_dL�Z" d\dxdO�Z#dydQ�Z$dzdS�Z%d{dU�Z&d|dV�Z'dW�Z( d}d~d[�Z)d S)�ColumnCollectiona�Collection of :class:`_expression.ColumnElement` instances, typically for :class:`_sql.FromClause` objects. The :class:`_sql.ColumnCollection` object is most commonly available as the :attr:`_schema.Table.c` or :attr:`_schema.Table.columns` collection on the :class:`_schema.Table` object, introduced at :ref:`metadata_tables_and_columns`. The :class:`_expression.ColumnCollection` has both mapping- and sequence- like behaviors. A :class:`_expression.ColumnCollection` usually stores :class:`_schema.Column` objects, which are then accessible both via mapping style access as well as attribute access style. To access :class:`_schema.Column` objects using ordinary attribute-style access, specify the name like any other object attribute, such as below a column named ``employee_name`` is accessed:: >>> employee_table.c.employee_name To access columns that have names with special characters or spaces, index-style access is used, such as below which illustrates a column named ``employee ' payment`` is accessed:: >>> employee_table.c["employee ' payment"] As the :class:`_sql.ColumnCollection` object provides a Python dictionary interface, common dictionary method names like :meth:`_sql.ColumnCollection.keys`, :meth:`_sql.ColumnCollection.values`, and :meth:`_sql.ColumnCollection.items` are available, which means that database columns that are keyed under these names also need to use indexed access:: >>> employee_table.c["values"] The name for which a :class:`_schema.Column` would be present is normally that of the :paramref:`_schema.Column.key` parameter. In some contexts, such as a :class:`_sql.Select` object that uses a label style set using the :meth:`_sql.Select.set_label_style` method, a column of a certain key may instead be represented under a particular label name such as ``tablename_columnname``:: >>> from sqlalchemy import select, column, table >>> from sqlalchemy import LABEL_STYLE_TABLENAME_PLUS_COL >>> t = table("t", column("c")) >>> stmt = select(t).set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL) >>> subq = stmt.subquery() >>> subq.c.t_c <sqlalchemy.sql.elements.ColumnClause at 0x7f59dcf04fa0; t_c> :class:`.ColumnCollection` also indexes the columns in order and allows them to be accessible by their integer position:: >>> cc[0] Column('x', Integer(), table=None) >>> cc[1] Column('y', Integer(), table=None) .. versionadded:: 1.4 :class:`_expression.ColumnCollection` allows integer-based index access to the collection. Iterating the collection yields the column expressions in order:: >>> list(cc) [Column('x', Integer(), table=None), Column('y', Integer(), table=None)] The base :class:`_expression.ColumnCollection` object can store duplicates, which can mean either two columns with the same key, in which case the column returned by key access is **arbitrary**:: >>> x1, x2 = Column("x", Integer), Column("x", Integer) >>> cc = ColumnCollection(columns=[(x1.name, x1), (x2.name, x2)]) >>> list(cc) [Column('x', Integer(), table=None), Column('x', Integer(), table=None)] >>> cc["x"] is x1 False >>> cc["x"] is x2 True Or it can also mean the same column multiple times. These cases are supported as :class:`_expression.ColumnCollection` is used to represent the columns in a SELECT statement which may include duplicates. A special subclass :class:`.DedupeColumnCollection` exists which instead maintains SQLAlchemy's older behavior of not allowing duplicates; this collection is used for schema level objects like :class:`_schema.Table` and :class:`.PrimaryKeyConstraint` where this deduping is helpful. The :class:`.DedupeColumnCollection` class also has additional mutation methods as the schema constructs have more use cases that require removal and replacement of columns. .. versionchanged:: 1.4 :class:`_expression.ColumnCollection` now stores duplicate column keys as well as the same column in multiple positions. The :class:`.DedupeColumnCollection` class is added to maintain the former behavior in those cases where deduplication as well as additional replace/remove operations are needed. )� _collection�_index�_colsetrwz6List[Tuple[_COLKEY, _COL_co, _ColumnMetrics[_COL_co]]]r�z4Dict[Union[None, str, int], Tuple[_COLKEY, _COL_co]]r�z6Dict[ColumnElement[Any], Set[_ColumnMetrics[_COL_co]]]rwz Set[_COL_co]r�Nrg�+Optional[Iterable[Tuple[_COLKEY, _COL_co]]]c�h�t�|dt����t�|di��t�|dtjt j����t�|dg��|r|�|��dSdS)Nr�r�rwr�)r�r�r� collections� defaultdictr*� OrderedSet�_initial_populate)rVrgs rWr�zColumnCollection.__init__�s��� ���4��C�E�E�2�2�2����4��2�.�.�.���� �.�+�"9�$�/�"J�"J� � � � ���4���3�3�3� � ,� � "� "�7� +� +� +� +� +� ,� ,rYzsqlalchemy.sql.elementsrmr9c�^�tjj}|j|jt jdd��S)NF)�_literal_as_text_rolerZ)r*r9� sql_elementsr9� _all_columnsr�ColumnsClauseRole�rVr3s rW�__clause_element__z#ColumnCollection.__clause_element__�s;���>�.��"�x�"�� �#(�"9�� � � � rY�iter_�!Iterable[Tuple[_COLKEY, _COL_co]]r�c�0�|�|��dSro��_populate_separate_keys�rVr�s rWr�z"ColumnCollection._initial_populates�� �$�$�U�+�+�+�+�+rY� List[_COL_co]c�$�d�|jD��S)Nc��g|]\}}}|�� Sr^r^�r�r rus rWr�z1ColumnCollection._all_columns.<locals>.<listcomp> ���8�8�8� ��C���8�8�8rY�r�rUs rWr�zColumnCollection._all_columnss��8�8�t�'7�8�8�8�8rY� List[_COLKEY]c�$�d�|jD��S)zQReturn a sequence of string key names for all columns in this collection.c��g|]\}}}|�� Sr^r^)r�r\r s rWr�z)ColumnCollection.keys.<locals>.<listcomp>s��4�4�4�i�q�!�Q��4�4�4rYr�rUs rW�keyszColumnCollection.keys s��5�4�4�#3�4�4�4�4rYc�$�d�|jD��S)z�Return a sequence of :class:`_sql.ColumnClause` or :class:`_schema.Column` objects for all columns in this collection.c��g|]\}}}|�� Sr^r^r�s rWr�z+ColumnCollection.values.<locals>.<listcomp>r�rYr�rUs rWr#zColumnCollection.valuess��9�8�t�'7�8�8�8�8rY�List[Tuple[_COLKEY, _COL_co]]c�$�d�|jD��S)z�Return a sequence of (key, column) tuples for all columns in this collection each consisting of a string key name and a :class:`_sql.ColumnClause` or :class:`_schema.Column` object. c��g|] \}}}||f�� Sr^r^�r�r\rur s rWr�z*ColumnCollection.items.<locals>.<listcomp>s"��=�=�=�[�a��a��C��=�=�=rYr�rUs rWr�zColumnCollection.itemss��>�=�D�,<�=�=�=�=rYr�c�*�t|j��Sro)r�r�rUs rW�__bool__zColumnCollection.__bool__s���D�$�%�%�%rYr3c�*�t|j��Sro)rr�rUs rWr$zColumnCollection.__len__"s���4�#�$�$�$rY�Iterator[_COL_co]c�>�td�|jD����S)Nc��g|]\}}}|�� Sr^r^r�s rWr�z-ColumnCollection.__iter__.<locals>.<listcomp>'s��;�;�;�Y�Q��Q�S�;�;�;rY)r2r�rUs rWr)zColumnCollection.__iter__%s"���;�;�$�*:�;�;�;�<�<�<rYry�Union[str, int]rlc��dSror^r}s rWrzColumnCollection.__getitem__)s��<?�CrY�Tuple[Union[str, int], ...]�*ReadOnlyColumnCollection[_COLKEY, _COL_co]c��dSror^r}s rWrzColumnCollection.__getitem__,� ��69�SrY�slicec��dSror^r}s rWrzColumnCollection.__getitem__1r�rY�3Union[str, int, slice, Tuple[Union[str, int], ...]]�:Union[ReadOnlyColumnCollection[_COLKEY, _COL_co], _COL_co]c��� t|ttf��r\t|t��rd��j|D��}n�fd�|D��}t |�����S�j|dS#t$rA}t|jdt��rt|jd��|��d}~wwxYw)Nc3�&K�|] \}}}||fV�� dSror^)r��sub_keyrur s rWr!z/ColumnCollection.__getitem__.<locals>.<genexpr><s@������-�W�c�1�!�#�������rYc3�2�K�|]}�j|V��dSro�r�)r�r�rVs �rWr!z/ColumnCollection.__getitem__.<locals>.<genexpr>As*�����D�D�W�D�K��0�D�D�D�D�D�DrYrr) r�r�r�r�r�� as_readonlyr�r r�r3� IndexError)rVry�colsrs` rWrzColumnCollection.__getitem__6s���� ��#��u�~�.�.� +��c�5�)�)�E���15�1A�#�1F����D�D� E�D�D�D��D�D�D�D�'��-�-�9�9�;�;�;��{�3�'��*�*��� � � ��#�(�1�+�s�+�+� � ���!��-�-�3�6������  ���s�A7B�;B� C�<C�Crzc�n� |j|dS#t$r}t|��|�d}~wwxYw)Nr)r�r �AttributeError)rVryrs rWr~zColumnCollection.__getattr__LsH�� /��;�s�#�A�&� &��� /� /� /� ��%�%�3� .����� /���s�� 4�/�4c�n�||jvr+t|t��stjd���dSdS)Nz'__contains__ requires a string argumentFT)r�r�rzr)rr}s rW� __contains__zColumnCollection.__contains__RsE�� �d�k� !� !��c�3�'�'� ��'�=�����5��4rYr��ColumnCollection[Any, Any]c�@�t||��D] \}}||urdS� dS)zdCompare this :class:`_expression.ColumnCollection` to another based on the names of the keysFTr)rVr��l�rs rW�comparezColumnCollection.compare\s=�� ��e�,�,� � �D�A�q���z�z��u�u���4rYrc�,�|�|��Sro)r�)rVr�s rWr�zColumnCollection.__eq__fs���|�|�E�"�"�"rYrk�Optional[_COL_co]c��dSror^�rVryrks rWr�zColumnCollection.getis��HK�rYro�Union[_COL_co, _COL]c��dSror^r�s rWr�zColumnCollection.getls��DG�CrY�Optional[_COL]�Optional[Union[_COL_co, _COL]]c�>�||jvr|j|dS|S)z�Get a :class:`_sql.ColumnClause` or :class:`_schema.Column` object based on a string key name from this :class:`_expression.ColumnCollection`.rr�r�s rWr�zColumnCollection.getos(�� �$�+� � ��;�s�#�A�&� &��NrYc�`�|jj�dd�d�|D�����d�S)Nr�r�c3�4K�|]}t|��V��dSro)rzr�s rWr!z+ColumnCollection.__str__.<locals>.<genexpr>~s(����+�+��c�!�f�f�+�+�+�+�+�+rYr�)r�rZr�rUs rW�__str__zColumnCollection.__str__{s>�� �N� #� #� #� �I�I�+�+�d�+�+�+� +� +� +� +� � rYrrc��t���ror�r6s rWrzColumnCollection.__setitem__����!�#�#�#rYc��t���ror�r}s rWrzColumnCollection.__delitem__�r�rYr�c��t���ror�)rVryr�s rWr�zColumnCollection.__setattr__�r�rYc��t���)zQDictionary clear() is not implemented for :class:`_sql.ColumnCollection`.r�rUs rW�clearzColumnCollection.clear����"�#�#�#rYrrc��t���ror�)rVrrs rW�removezColumnCollection.remove�r�rYc��t���)zRDictionary update() is not implemented for :class:`_sql.ColumnCollection`.r�r�s rWrMzColumnCollection.update�r�rYc�H���fd�|D��x�jdd�<}�j�d�|D�����j�d�t |��D�����j�d�t |��D����dS)�*populate from an iterator of (key, column)c�<��g|]\}}||t�|��f��Sr^�rq�r�r\r�rVs �rWr�z<ColumnCollection._populate_separate_keys.<locals>.<listcomp>�s;���, �, �, �04��1�Q��>�$��*�*� +�, �, �, rYNc3�FK�|]\}}}|���V��dSro�� _deannotate)r�r r�s rWr!z;ColumnCollection._populate_separate_keys.<locals>.<genexpr>�s0����F�F���1�a�A�M�M�O�O�F�F�F�F�F�FrYc�&�i|]\}\}}}|||f��Sr^r^�r��idxr\r�r s rWr�z<ColumnCollection._populate_separate_keys.<locals>.<dictcomp>�s(�� E� E� E�^�S�)�1�a��S�1�a�&� E� E� ErYc� �i|] \}}}|||f�� Sr^r^r�s rWr�z<ColumnCollection._populate_separate_keys.<locals>.<dictcomp>�s$��N�N�N�I�A�s�A�A��3�x�N�N�NrY)r�r�rMr�� enumeraterN)rVr�rss` rWr�z(ColumnCollection._populate_separate_keys�s���� , �, �, �, �8=�, �, �, � �������j� � ���F�F�:�F�F�F�F�F�F� � ��� E� E�y��/D�/D� E� E� E� � � � � ���N�N��*�9M�9M�N�N�N�O�O�O�O�OrYrm�Optional[_COLKEY]c�d�|�|j}n|}t|j��}tt|��}|j�||t ||��f��|j�|� ����||f|j |<||j vr||f|j |<dSdS)a�Add a column to this :class:`_sql.ColumnCollection`. .. note:: This method is **not normally used by user-facing code**, as the :class:`_sql.ColumnCollection` is usually part of an existing object such as a :class:`_schema.Table`. To add a :class:`_schema.Column` to an existing :class:`_schema.Table` object, use the :meth:`_schema.Table.append_column` method. N) ryrr�r rl�appendrqr�ryr�r�)rVrrry�colkeyr��_columns rWryzColumnCollection.add�s��� �;��Z�F�F��F� �� � !� !�� �w��'�'�� ���� �W�n�T�7�;�;� <� � � � � ����,�,�.�.�/�/�/� �'�*�� �A�� ��� $� $�#)�7�"3�D�K�� � � � %� $rYrUc�4�d�|jD��|jd�S)Nc��g|] \}}}||f�� Sr^r^�r�r\r�r s rWr�z1ColumnCollection.__getstate__.<locals>.<listcomp>�s"��C�C�C�w�q�!�Q�Q��F�C�C�CrY�r�r�r�rUs rW� __getstate__zColumnCollection.__getstate__�s*��C�C�$�2B�C�C�C��k� � � rY�statec�n��t��d|d��t��dtjtj����t��d�fd�|dD����t��dd��jD����dS)Nr�rwr�c�<��g|]\}}||t�|��f��Sr^r�r�s �rWr�z1ColumnCollection.__setstate__.<locals>.<listcomp>�s>��� � � ��Q���A�~�d�A�.�.�/� � � rYr�c��h|]\}}}|�� Sr^r^r�s rWr�z0ColumnCollection.__setstate__.<locals>.<setcomp>�s��D�D�D�i�a��a�c�D�D�DrY)r�r�r�r�r*r�r�)rVr�s` rW� __setstate__zColumnCollection.__setstate__�s�������4��5��?�;�;�;���� �.�+�"9�$�/�"J�"J� � � � ��� � � � � � �#�M�2� � � � � � � ��� �)�D�D�4�3C�D�D�D� � � � � rYruc�n�||jvr+t|t��rtjd���dSdS)z3Checks if a column object exists in this collectionzZcontains_column cannot be used with string arguments. Use ``col_name in table.c`` instead.FT)r�r�rzr)r�rVrus rW�contains_columnz ColumnCollection.contains_column�sG�� �d�l� "� "��#�s�#�#� ��'�;�����5��4rYc� �t|��S)zIReturn a "read only" form of this :class:`_sql.ColumnCollection`.)�ReadOnlyColumnCollectionrUs rWr�zColumnCollection.as_readonly�s��(��-�-�-rYc��|j}|rdS|jD]2\}}}|jj}|D]}||�|����3dS)a�populate the "proxy index", if empty. proxy index is added in 2.0 to provide more efficient operation for the corresponding_column() method. For reasons of both time to construct new .c collections as well as memory conservation for large numbers of large .c collections, the proxy_index is only filled if corresponding_column() is called. once filled it stays that way, and new _ColumnMetrics objects created after that point will populate it with new data. Note this case would be unusual, if not nonexistent, as it means a .c collection is being mutated after corresponding_column() were used, however it is tested in test/base/test_utils.py. N)rwr�rrrxry)rVrzr �metrics�epsr{s rW�_init_proxy_indexz"ColumnCollection._init_proxy_index�sr�� � �� � � �F�!�-� )� )�M�A�q�'��.�4�C�� )� )���7� ����(�(�(�(� )� )� )rYF�require_embedded�Optional[Union[_COL, _COL_co]]c��� ��|jvr�Sd\}}�j}|j� � s|���� fd�|D��D]�}|r|�|��r�|�|}�|�|jj��}|�|�|jj��}t|��t|��kr|}|}��||krnt�fd�|j� ��D����}t�fd�|j� ��D����} | |kr|}|}��|r|jndS)a�Given a :class:`_expression.ColumnElement`, return the exported :class:`_expression.ColumnElement` object from this :class:`_expression.ColumnCollection` which corresponds to that original :class:`_expression.ColumnElement` via a common ancestor column. :param column: the target :class:`_expression.ColumnElement` to be matched. :param require_embedded: only return corresponding columns for the given :class:`_expression.ColumnElement`, if the given :class:`_expression.ColumnElement` is actually present within a sub-element of this :class:`_expression.Selectable`. Normally the column will match if it merely shares a common ancestor with one of the exported columns of this :class:`_expression.Selectable`. .. seealso:: :meth:`_expression.Selectable.corresponding_column` - invokes this method against the collection returned by :attr:`_expression.Selectable.exported_columns`. .. versionchanged:: 1.4 the implementation for ``corresponding_column`` was moved onto the :class:`_expression.ColumnCollection` itself. )NNc3�:�K�|]}|�v��|D]}|V���dSror^)r��ts�mmrzs �rWr!z8ColumnCollection.corresponding_column.<locals>.<genexpr>=s>����� � ��r�R�x�x�"�R�&�x�x�B�B�x�x�x�x�x� � rYNc�p��g|]2}|�����|j�dd����3S��weightr��shares_lineager�r��r��scrrs �rWr�z9ColumnCollection.corresponding_column.<locals>.<listcomp>b�Q������ "� "�0�0��8�8� ��O�/�/��!�<�<���rYc�p��g|]2}|�����|j�dd����3Srrrs �rWr�z9ColumnCollection.corresponding_column.<locals>.<listcomp>krrY) r�r�rwr r�r�rrrxrr"�_uncached_proxy_list) rVrrr �selected_intersection�selected_metricsr��current_metrics�current_intersection�selected_col_distance�current_col_distancerzs ` @rW�corresponding_columnz%ColumnCollection.corresponding_columns�����H �T�\� !� !��M�2<�/��/��%� � � ��� %� � "� "� $� $� $� � � � �#� � � �8 E�8 E�O�$�5 E��'?�'?� �'K�'K�5 E�#�+�'6�$��'1�'>�'>�#�*�>�(�(�$�)�0�,6�,C�,C�(�/�C�-�-�)��+�,�,�s�3H�/I�/I�I�I� (7�$�,@�)�)�)�-B�B�B�-0�����!1� 7� L� L� N� N����-�-�)�,/�����!0� 6� K� K� M� M����,�,�(�,�.C�C�C�+:�(�0D�-��*:�D��&�&��DrYro)rgr�)rmr9)r�r�rmr�)rmr�)rmr�)rmr�)rmr�)rmr3)rmr�)ryr�rmrl)ryr�rmr�)ryr�rmr�)ryr�rmr�)ryrzrmrl)ryrzrmr�)r�r�rmr�)r�rrmr�)ryrzrkr�rmr�)ryrzrkrormr�)ryrzrkr�rmr�r9)ryrzrrrmr)ryrzrmr)ryrzr�rrmr)rmr)rrrrmr�)r�rrmr)rrrmryr�rmr�)rmrU)r�rUrmr�)rurmrmr�)rmr�)F)rrror r�rmr )*rZr[r\r�r�rtr�r*�preload_moduler�r�rcr�r�r#r�r�r$r)rrr~r�r�r�r�r�rrr�r�r�rM�__hash__r�ryr�rrr�r r"r^rYrWr�r�xs��������j�j�XC�I�G�G�G�G�@�@�@�@�H�H�H�H�����FJ� ,� ,� ,� ,� ,��T��2�3�3� � � �4�3� �,�,�,�,� �9�9�9��X�9�5�5�5�5� 9�9�9�9� >�>�>�>�&�&�&�&�%�%�%�%�=�=�=�=��?�?�?��X�?� �9�9�9��X�9��9�9�9��X�9�����,/�/�/�/� ��������#�#�#�#��K�K�K�K��X�K� �G�G�G��X�G�37� � � � � � � � � � $�$�$�$�$�$�$�$�$�$�$�$�$�$�$�$� $�$�$�$�$�$�$�$� �H� P� P� P� P�DH�"4�"4�"4�"4�"4�H � � � �  � � � �" � � � �.�.�.�.� )�)�)�66;�hE�hE�hE�hE�hE�hE�hErYr�� _NAMEDCOLzNamedColumn[Any]c�J�eZdZdZ ddd �Zdd �Zdd�Zdd�Zdd�Z ddd�Z dS)�DedupeColumnCollectionauA :class:`_expression.ColumnCollection` that maintains deduplicating behavior. This is useful by schema level objects such as :class:`_schema.Table` and :class:`.PrimaryKeyConstraint`. The collection includes more sophisticated mutator methods as well to suit schema objects which require mutable column collections. .. versionadded:: 1.4 Nrrr%ry� Optional[str]rmr�c�`�|�|j|krtjd���|j}|�tjd���||jvrP|j|d}||urdS|�|��t j�|d��dS|�||��dS)N�KDedupeColumnCollection requires columns be under the same key as their .keyz-Can't add unnamed column to column collectionrr�) ryr)rr��replacer*rb�reset�_append_new_column)rVrrry�existings rWryzDedupeColumnCollection.add�s��� �?�v�z�S�0�0��#�-��� ��j�� �;��#�?��� � �$�+� � ��{�3�'��*�H��6�!�!��� �L�L�� � � � � "� (� (��� =� =� =� =� =� � #� #�C�� 0� 0� 0� 0� 0rYrz� named_columnc� �t|j��}|j�||t||��f��|j�|�����||f|j|<||f|j|<dSro)rr�r�rqr�ryr�r�)rVryr/r�s rWr-z)DedupeColumnCollection._append_new_column�s��� �� � !� !�� ���� �,��t�\� B� B� C� � � � � ����1�1�3�3�4�4�4��|�,�� �A����.�� �C���rYr��Iterable[Tuple[str, _NAMEDCOL]]c ��t|��}g}|D]�\}}|j|krtjd���|j|jvr&|j|jkr|�|���X|j|jvr|�|���|||f|j|<|j�||t||��f����|j � d�|jD����|j� d�t|j��D����|D]}|� |���dS)r�r*c3�FK�|]\}}}|���V��dSror�r�s rWr!zADedupeColumnCollection._populate_separate_keys.<locals>.<genexpr>�s0����N�N� ��A�q�A�M�M�O�O�N�N�N�N�N�NrYc3�0K�|]\}\}}}|||ffV��dSror^r�s rWr!zADedupeColumnCollection._populate_separate_keys.<locals>.<genexpr>�sE���� � �,�c�9�A�q�!�S�1�a�&�M� � � � � � rYN) �listryr)rrTr�r�r�rqr�rMr�r+)rVr�r�� replace_colr\rus rWr�z.DedupeColumnCollection._populate_separate_keys�s}���E�{�{��� �� M� M�F�A�s��w�!�|�|��'�1�����x�4�;�&�&�3�7�c�h�+>�+>��"�"�3�'�'�'�'���D�K�'�'��"�"�3�'�'�'�'�"#�S��� �A��� �'�'��C���c�1J�1J�(K�L�L�L�L� � ���N�N�T�=M�N�N�N�N�N�N� � ��� � �09�$�:J�0K�0K� � � � � � �� � �C� �L�L�� � � � � � rY�Iterable[_NAMEDCOL]c�D�|�d�|D����dS)Nc3�(K�|] }|j|fV��dSro)ry)r�rus rWr!z0DedupeColumnCollection.extend.<locals>.<genexpr>�s(����$E�$E��c�g�s�^�$E�$E�$E�$E�$E�$ErYr�r�s rW�extendzDedupeColumnCollection.extend�s+�� �$�$�$E�$E�u�$E�$E�$E�E�E�E�E�ErYc�����|jvrtd�z���|j�j=|j�����fd�|jD��|jdd�<|j��d��D]}|�|���|j� d�t|j��D����|jt|j��=dS)Nz8Can't remove column %r; column is not in this collectionc�*��g|]\}}}|�u� |||f��Sr^r^)r�r\r�r rrs �rWr�z1DedupeColumnCollection.remove.<locals>.<listcomp>�s6��� � � ���A�w�������7�O���rYr^c�&�i|]\}\}}}|||f��Sr^r^�r�r�r\rur s rWr�z1DedupeColumnCollection.remove.<locals>.<dictcomp>��)�� O� O� O�/�s�K�Q��Q�S�1�c�(� O� O� OrY) r�r r�ryr�r�rwr�r�rMr�r)rVrrr s ` rWr�zDedupeColumnCollection.remove�s��� ��� %� %��J����� � �K�� � #� � ���F�#�#�#� � � � �#'�#3� � � ������� �(�,�,�V�R�8�8� "� "�G� �O�O�D� !� !� !� !� � ��� O� O�9�T�=M�3N�3N� O� O� O� � � � �K��D�,�-�-� .� .� .rY� extra_remove�Optional[Iterable[_NAMEDCOL]]c ���|rt|��}nt��}|j|jvrM|j|jkr=|j|jd}|j|jkr|�|��|j|jvr+|�|j|jd��|s|�|j|��dSg}d}|jD]R\}}} ||vr0|s-d}|�|j|t||��f���:|�||| f���S|rR|j � |��|D]5} |j � | d��D]} | � |����6|s+|�|j|t||��f��|j �|�����||jdd�<|j���|j�d�t#|j��D����|j�d�|jD����dS)aadd the given column to this collection, removing unaliased versions of this column as well as existing columns with the same key. e.g.:: t = Table("sometable", metadata, Column("col1", Integer)) t.columns.replace(Column("col1", Integer, key="columnone")) will remove the original 'col1' from the collection, and add the new column under the name 'columnname'. Used by schema.Column to override columns during table reflection. rNFTr^c�&�i|]\}\}}}|||f��Sr^r^r>s rWr�z2DedupeColumnCollection.replace.<locals>.<dictcomp>'r?rYc� �i|] \}}}|||f�� Sr^r^r�s rWr�z2DedupeColumnCollection.replace.<locals>.<dictcomp>)s$��L�L�L�K�Q��Q�A��3�x�L�L�LrY)rrTr�ryryr-r�r�rqr��difference_updaterwr�r�r�r�rMr�) rVrrr@� remove_colr��new_cols�replacedr\rur �rcs rWr+zDedupeColumnCollection.replace�s���* � ��\�*�*�J�J����J� �;�$�+� %� %�&�*�� �*C�*C��K�� �,�Q�/�E��z�U�Y�&�&����u�%�%�%� �:��� $� $� �N�N�4�;�v�z�2�1�5� 6� 6� 6�� � � #� #�F�J�� 7� 7� 7� �F�KM����#�/� 3� 3�O�A�s�G��j� � ���#�H��O�O���V�^�D�&�-I�-I�J���������C�� 1�2�2�2�2� � *� �L� *� *�:� 6� 6� 6� � *� *��#�0�4�4�R��<�<�*�*�G��O�O�D�)�)�)�)�*�� P� �O�O�V�Z����f�1M�1M�N� O� O� O� � ����+�+�-�-�.�.�.�&������� � ������ � ��� O� O�9�T�=M�3N�3N� O� O� O� � � � � ���L�L�4�;K�L�L�L�M�M�M�M�MrYro)rrr%ryr(rmr�)ryrzr/r%rmr�)r�r1rmr�)r�r7rmr�)rrr%rmr�)rrr%r@rArmr�) rZr[r\r�ryr-r�r:r�r+r^rYrWr'r'}s������� � �7;�1�1�1�1�1�</�/�/�/�����8F�F�F�F�/�/�/�/�27;�CN�CN�CN�CN�CN�CN�CNrYr'c�>�eZdZdZd�Zd�Zd�Zddd �Zdd �Zdd�Z dS)r��_parentc�F�t�|d|��t�|d|j��t�|d|j��t�|d|j��t�|d|j��dS)NrLr�r�r�rw)r�r�r�r�r�rw)rVrss rWr�z!ReadOnlyColumnCollection.__init__1s������4��J�7�7�7����4��J�,>�?�?�?����4��:�+<�=�=�=����4�� �0F�G�G�G����4���1H�I�I�I�I�IrYc��d|jiS�NrLrKrUs rWr�z%ReadOnlyColumnCollection.__getstate__8s���4�<�(�(rYc�@�|d}|�|��dSrO)r�)rVr�rIs rWrz%ReadOnlyColumnCollection.__setstate__;s$���y�!�� � � �f�����rY.rrrryrmc�.�|���dSro�� _readonly)rVrrrys rWryzReadOnlyColumnCollection.add?��� �������rYr3rc�.�|���dSrorRr�s rWr:zReadOnlyColumnCollection.extendBrTrY�itemc�.�|���dSrorR)rVrVs rWr�zReadOnlyColumnCollection.removeErTrYN).)rrrryrrmr)r3rrmr)rVrrmr) rZr[r\r�r�r�rryr:r�r^rYrWrr,s��������I�J�J�J�)�)�)������������������rYrc�&�eZdZd�Zd�Zd�Zd�ZdS)� ColumnSetc� �||vSror^rs rWrzColumnSet.contains_columnJs ���d�{�rYc�:�|D]}|�|���dSro)ry)rVr�rus rWr:zColumnSet.extendMs,��� � �C� �H�H�S�M�M�M�M� � rYc��g}|D]5}|D]0}|�|��r|�||k���1�6tj|�Sro)rr�r3�and_)rVr�r�r�r�s rWr�zColumnSet.__eq__Qsf�� ��� )� )�A�� )� )���#�#�E�*�*�)��H�H�Q�%�Z�(�(�(�� )��}�a� � rYc�N�ttd�|D������S)Nc3�K�|]}|V��dSror^r�s rWr!z%ColumnSet.__hash__.<locals>.<genexpr>Zs"����*�*��!�*�*�*�*�*�*rY)�hashr�rUs rWr$zColumnSet.__hash__Ys'���E�*�*�T�*�*�*�*�*�+�+�+rYN)rZr[r\rr:r�r$r^rYrWrYrYIsP������������!�!�!�,�,�,�,�,rYrYzColumnClause[Any]�entity�1Union[_HasEntityNamespace, ExternallyTraversible]c��� tt|��jS#t$rFt jtt |����D]}t|��r |jccYS��wxYw)z�Return the nearest .entity_namespace for the given entity. If not immediately available, does an iterate to find a sub-element that has one, if any. )r r�r�r�r�iterater%r�)rar�s rW�_entity_namespacere]s�����'��0�0�A�A�� �����$�T�*?��%H�%H�I�I� � �D�'��-�-� -��,�,�,�,�,�,� -� � ���s��A A,�)A,ryrk�%Union[SQLCoreOperations[Any], _NoArg]r{c��� t|��}|turt|||��St||��S#t$r!}t jd|�d|�d���|�d}~wwxYw)z�Return an entry from an entity_namespace. Raises :class:`_exc.InvalidRequestError` rather than attribute error on not found. zEntity namespace for "z" has no property "�"N)rer]r�r�r)r�)raryrk�nsrs rW�_entity_namespace_keyrjps��� � �v� &� &�� �&� � ��2�s�G�,�,� ,��2�s�#�#� #�� �����%�%�@F������ L� � �� ��������s�(;�;� A&�A!�!A&)r�rrmr�)r3r�rmr�)r3r�rmrB)r�rdrmrd)r�rzr�rrmr�)r3r�rmr�)r�r�r�r�rmr�)rarbrmrx)rarbryrzrkrfrmr{)�r�� __future__rr��enumrr�rr�rWr-rrr r r r r rrrrrrrrrrrrrrr�rr� cache_keyr r!� traversalsr"r#r$r%r&r(r)r*r+r,� compat_typing� util.typingr.r/r0r1r3r4� _orm_typesr5r6�_typingr7r8r9r:r;r<r=r>�schemar?r@� selectablerArBrC�enginerDrE�engine.interfacesrFrGrHrIrJrKrLrMrNrOrPrRr]r`ra� _NONE_NAMErbrdrz�_AmbiguousTableNameMaprfr��_never_select_columnrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr+r#r@rBrer�r�r��typer�r�r�r�� StatementRolers� EventTargetrGrRrVrfrkrlrorqr�r%r'�ReadOnlyContainerrr�rYrerjr^rYrW�<module>rs1 ���� #�"�"�"�"�"���������������!�!�!�!�!�!����� � � � �������������������������������������������������������������!�!�!�!�!�!������������������������������������������������� � � � � � �������������������������"�"�"�"�"�"�*�*�*�*�*�*�(�(�(�(�(�(�#�#�#�#�#�#�/�/�/�/�/�/�+�+�+�+�+�+�'�'�'�'�'�'�������������������-�-�-�-�-�-�������*�*�*�*�*�*�"�"�"�"�"�"�������#�#�#�#�#�#��#�������������������/�/�/�/�/�/�6�6�6�6�6�6�������'�'�'�'�'�'�$�$�$�$�$�$�&�&�&�&�&�&�'�'�'�'�'�'�%�%�%�%�%�%�+�+�+�+�+�+�$�$�$�$�$�$�������(�(�(�(�(�(�.�.�.�.�.�.�+�+�+�+�+�+�&�&�&�&�&�&�#�#�#�#�#�#�%�%�%�%�%�%�;�;�;�;�;�;�3�3�3�3�3�3�<�<�<�<�<�<�.�.�.�.�.�.�,�,�,�,�,�,�5�5�5�5�5�5�?�?�?�?�?�?�+�+�+�+�+�+�2�2�2�2�2�2�:�:�:�:�:�:�"�"�"�"�"�"����I��H��H�%�%�%�%�%�T�%�%�%� ���I�I�I�I�I��I�I�I� � � � �W�T������ �g�e�8�C��H�-�.�.�.��'��S��1�� � � � � �z� � � �4+�x�*�+B�C�C��C�C�C�C�C�x�C�C�C�8�8�8�8�8�(�8�8�8� 0�0�0�0� ���s�#�#�#�� � � � � � � � �@����� ����<���� � � � ��g�3�;L�M�M�M��%�%�%�%�%�m�,�%�%�%�����0����: � � �?�?�?�?�����N�N�N�N�����6 �6 �6 �6 �6 �n�S�#�X�.�6 �6 �6 �r$�$�$�$�$�n�S�#�X�.�$�$�$�@���*�+�+�1�1�,�+�1�gC�gC�gC�gC�gC�gC�gC�gC�Tg�g�g�g�g�g�g�g�T���������$ � � � � � � � � �?�?�?�?�?�j�?�?�?�5�5�5�5�5�4�5�5�5�B[5�[5�[5�[5�[5� �[5�[5�[5�[5�| @� @� @� @� @�w� � @� @� @� �����'����$n'�n'�n'�n'�n'��$�n'�n'�n'�b 8�8�8�8�8��)�8�8�8�*4�4�4�4�4�M�4�4�4� �����t���������j���� �'�)�U�4��9�-�s� 3� 3�� �'�)�#7�4� H� H� H���w�v�1�2�2�2��)�)�)�)�)�W�W�%�)�)�)�XE�E�E�E�E�w�w��/�0�E�E�E�D �G�K�'9� :� :� :� �lN�lN�lN�lN�lN�-�c�9�n�=�lN�lN�lN�^�������,�W�g�-=�>����:,�,�,�,�,��� 3�4�,�,�,�(����,6<�������rY
Memory