관리-도구
편집 파일: ext.cpython-311.pyc
� �܋f; � � � d dl mZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G d� d ej � � Z G d � de� � Zd� Zd S )� )�ARRAY� )�elements)� expression)� functions)�schema)�ColumnCollectionConstraintc �T � e Zd ZdZd Zd� Zdd�Zd� Zej fd�Z ed� � � 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:`_functions.array_agg` c �0 � t j |� � | _ | j j | _ t |� � }|dk rt d� � �|dk r!t j |d � � | _ d S t j |dt j i�| _ d S )N� z)at least one ORDER BY element is requiredr �_literal_as_text)r �_literal_as_binds�target�type�len� TypeError�order_by� ClauseList)�selfr r �_lobs �Y/opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/postgresql/ext.py�__init__zaggregate_order_by.__init__5 s� � ��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_groupC s � ��r c � � | j | j fS r �r r )r �kwargss r �get_childrenzaggregate_order_by.get_childrenF s � ��{�D�M�)�)r c �R � || j fi |��| _ || j fi |��| _ d S r r! )r �clone�kws r �_copy_internalsz"aggregate_order_by._copy_internalsI s<