관리-도구
편집 파일: ext.cpython-37.pyc
B ��4]� � @ sj d dl mZ ddlmZ ddlmZ ddlmZ ddlmZ G dd� dej�Z G d d � d e�Z dd� Zd S )� )�ARRAY� )�elements)� expression)� functions)�ColumnCollectionConstraintc @ sH e Zd ZdZd Zdd� Zd dd�Zdd� Zej fd d �Z edd� �ZdS )�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:`.array_agg` c G sX t �|�| _t|�}|dkr&td��n.|dkr@t �|d �| _nt j|dt ji�| _d S )N� z)at least one ORDER BY element is requiredr �_literal_as_text)r Z_literal_as_binds�target�len� TypeError�order_byZ ClauseList)�selfr r Z_lob� r �U/opt/alt/python37/lib64/python3.7/site-packages/sqlalchemy/dialects/postgresql/ext.py�__init__4 s zaggregate_order_by.__init__Nc C s | S )Nr )r Zagainstr r r � self_groupA s zaggregate_order_by.self_groupc K s | j | jfS )N)r r )r �kwargsr r r �get_childrenD s zaggregate_order_by.get_childrenc K s$ || j f|�| _ || jf|�| _d S )N)r r )r �clone�kwr r r �_copy_internalsG s z"aggregate_order_by._copy_internalsc C s | j j| jj S )N)r � _from_objectsr )r r r r r K s z aggregate_order_by._from_objects)N) �__name__� __module__�__qualname__�__doc__�__visit_name__r r r r Z_cloner �propertyr r r r r r s ! r c @ s6 e Zd ZdZdZdZe�ddd�dd� �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 Zexclude_constraintN�wherez:class:`.ExcludeConstraint`z$:paramref:`.ExcludeConstraint.where`c O s� g }g }i | _ t|� \}}xtt| �|�|�D ]`\\}}} } }| dk rN|�| � |dk r\|jn| }|dk rr|| j |<