Hacked By AnonymousFox

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

�

�܋f;���ddlmZddlmZddlmZddlmZddlmZddlmZGd�d	ej	��Z
Gd
�de��Zd�Zd
S)�)�ARRAY�)�elements)�
expression)�	functions)�schema)�ColumnCollectionConstraintc�T�eZdZdZdZd�Zdd�Zd�Zej	fd�Z
ed���ZdS)	�aggregate_order_bya�Represent a PostgreSQL aggregate order by expression.

    E.g.::

        from sqlalchemy.dialects.postgresql import aggregate_order_by
        expr = func.array_agg(aggregate_order_by(table.c.a, table.c.b.desc()))
        stmt = select([expr])

    would represent the expression::

        SELECT array_agg(a ORDER BY b DESC) FROM table;

    Similarly::

        expr = func.string_agg(
            table.c.a,
            aggregate_order_by(literal_column("','"), table.c.a)
        )
        stmt = select([expr])

    Would represent::

        SELECT string_agg(a, ',' ORDER BY a) FROM table;

    .. versionadded:: 1.1

    .. versionchanged:: 1.2.13 - the ORDER BY argument may be multiple terms

    .. seealso::

        :class:`_functions.array_agg`

    c�0�tj|��|_|jj|_t	|��}|dkrtd���|dkr!tj|d��|_dStj|dtji�|_dS)N�z)at least one ORDER BY element is requiredr�_literal_as_text)r�_literal_as_binds�target�type�len�	TypeError�order_by�
ClauseList)�selfrr�_lobs    �Y/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/postgresql/ext.py�__init__zaggregate_order_by.__init__5s����0��8�8����K�$��	��8�}�}���1�9�9��G�H�H�H�
�Q�Y�Y�$�6�x��{�C�C�D�M�M�M�$�/���,4�,F���D�M�M�M�Nc��|S�N�)r�againsts  r�
self_groupzaggregate_order_by.self_groupCs���rc��|j|jfSr�rr)r�kwargss  r�get_childrenzaggregate_order_by.get_childrenFs���{�D�M�)�)rc�R�||jfi|��|_||jfi|��|_dSrr!)r�clone�kws   r�_copy_internalsz"aggregate_order_by._copy_internalsIs<���e�D�K�.�.�2�.�.�����d�m�2�2�r�2�2��
�
�
rc�4�|jj|jjzSr)r�
_from_objectsr)rs rr)z aggregate_order_by._from_objectsMs���{�(�4�=�+F�F�Frr)
�__name__�
__module__�__qualname__�__doc__�__visit_name__rrr#r�_cloner'�propertyr)rrrrrs������� � �D*�N��������*�*�*�%-�O�3�3�3�3��G�G��X�G�G�Grrc�X�eZdZdZdZdZejddd��d���Zd	d�Z	dS)
�ExcludeConstraintz�A table-level EXCLUDE constraint.

    Defines an EXCLUDE constraint as described in the `postgres
    documentation`__.

    __ http://www.postgresql.org/docs/9.0/static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

    �exclude_constraintN�wherez:class:`.ExcludeConstraint`z$:paramref:`.ExcludeConstraint.where`c���g}g}i|_t|�\}}t|�|��|��D]d\\}}}	}
}|
�|�|
��|�|jn|	}|�
||j|<tj|��}|�|||f���e||_tj	|g|�R|�
d��|�
d��|�
d��d��|�
dd��|_|�
d��}
|
�tj|
d	�
��|_
|�
di��|_dS)a2
        Create an :class:`.ExcludeConstraint` object.

        E.g.::

            const = ExcludeConstraint(
                (Column('period'), '&&'),
                (Column('group'), '='),
                where=(Column('group') != 'some group'),
                ops={'group': 'my_operator_class'}
            )

        The constraint is normally embedded into the :class:`_schema.Table`
        construct
        directly, or added later using :meth:`.append_constraint`::

            some_table = Table(
                'some_table', metadata,
                Column('id', Integer, primary_key=True),
                Column('period', TSRANGE()),
                Column('group', String)
            )

            some_table.append_constraint(
                ExcludeConstraint(
                    (some_table.c.period, '&&'),
                    (some_table.c.group, '='),
                    where=some_table.c.group != 'some group',
                    name='some_table_excl_const',
                    ops={'group': 'my_operator_class'}
                )
            )

        :param \*elements:

          A sequence of two tuples of the form ``(column, operator)`` where
          "column" is a SQL expression element or a raw SQL string, most
          typically a :class:`_schema.Column` object,
          and "operator" is a string
          containing the operator to use.   In order to specify a column name
          when a  :class:`_schema.Column` object is not available,
          while ensuring
          that any necessary quoting rules take effect, an ad-hoc
          :class:`_schema.Column` or :func:`_expression.column`
          object should be
          used.

        :param name:
          Optional, the in-database name of this constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param using:
          Optional string.  If set, emit USING <index_method> when issuing DDL
          for this constraint. Defaults to 'gist'.

        :param where:
          Optional SQL expression construct or literal SQL string.
          If set, emit WHERE <predicate> when issuing DDL
          for this constraint.

        :param ops:
          Optional dictionary.  Used to define operator classes for the
          elements; works the same way as that of the
          :ref:`postgresql_ops <postgresql_operator_classes>`
          parameter specified to the :class:`_schema.Index` construct.

          .. versionadded:: 1.3.21

          .. seealso::

            :ref:`postgresql_operator_classes` - general description of how
            PostgreSQL operator classes are specified.

        N�name�
deferrable�	initially)r6r7r8�using�gistr4T)�allow_coercion_to_text�ops)�	operators�zip�"_extract_col_expression_collection�appendr6r�_literal_as_column�
_render_exprsr	r�getr9rr4r<)rrr&�columns�render_exprs�expressionsr=�expr�column�strname�add_element�operatorr6r4s              rrzExcludeConstraint.__init__`s���n�������!$�h����Y�>A��3�3�K�@�@�)�?
�?
�	8�	8�:�0�T�6�7�K�(��&����{�+�+�+�"(�"4�6�;�;�'�D���'/���t�$��0��6�6�D�����t�X� 6�7�7�7�7�)���"�+��	
�
�	
�	
��������v�v�l�+�+��f�f�[�)�)�	
�	
�	
�	
��V�V�G�V�,�,��
����w������#�4��d����D�J��6�6�%��$�$����rc	�������fd��jD��}�j|�j�j�j�j�jd��}|j��j��|S)Nc�j��g|]/}tj|�j����j|jf��0Sr)r�_copy_expression�parentr=r6)�.0rGr�target_tables  ��r�
<listcomp>z*ExcludeConstraint.copy.<locals>.<listcomp>�sM���
�
�
�
��'��d�k�<�H�H���t�y�)�
�
�
�
r)r6r7r8r4r9)	rD�	__class__r6r7r8r4r9�dispatch�_update)rrQr&r�cs``   r�copyzExcludeConstraint.copy�s�����
�
�
�
�
�
��
�
�
��
�D�N�
������n��*��*�

�
�
��	
�
���4�=�)�)�)��rr)
r*r+r,r-r.r4r�_document_text_coercionrrWrrrr2r2Rsv��������*�N��E�%�X�%��%�.���
x%�x%���
x%�t�����rr2c�B�t|d<tjj|i|��S)z�PostgreSQL-specific form of :class:`_functions.array_agg`, ensures
    return type is :class:`_postgresql.ARRAY` and not
    the plain :class:`_types.ARRAY`, unless an explicit ``type_``
    is passed.

    .. versionadded:: 1.1

    �_default_array_type)rr�func�	array_agg)�argr&s  rr\r\�s'��!&�B����>�#�S�/�B�/�/�/rN)
�arrayr�sqlrrrr�
sql.schemar	�
ColumnElementrr2r\rrr�<module>rbs���������������������������������4�4�4�4�4�4�?G�?G�?G�?G�?G��1�?G�?G�?G�D^�^�^�^�^�2�^�^�^�B
0�
0�
0�
0�
0r

Hacked By AnonymousFox1.0, Coded By AnonymousFox