o
    y¬´\Lg  ã                   @   sÚ  d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ e e ¡Z!dodd„Z"G dd„ de
eeƒZ#G d d!„ d!e$ƒZ%e%ƒ Z&	 e%d"d#�Z'G d$d%„ d%e#ƒZ(G d&d'„ d'eƒZ)G d(d)„ d)e *e)e(¡ƒZ+e"d*eƒ e"d+eƒ G d,d-„ d-e+ƒZ,G d.d/„ d/e+ƒZ-G d0d1„ d1e+ƒZ.G d2d3„ d3e.ƒZ/G d4d5„ d5e.ƒZ0G d6d7„ d7e.ƒZ1G d8d9„ d9e.ƒZ2G d:d;„ d;e+ƒZ3G d<d=„ d=e+ƒZ4G d>d?„ d?e+ƒZ5G d@dA„ dAe+ƒZ6G dBdC„ dCe+ƒZ7G dDdE„ dEe-ƒZ8G dFdG„ dGe-ƒZ9G dHdI„ dIe-ƒZ:G dJdK„ dKe-ƒZ;G dLdM„ dMe-ƒZ<G dNdO„ dOe-ƒZ=G dPdQ„ dQe-ƒZ>G dRdS„ dSe-ƒZ?G dTdU„ dUe-ƒZ@G dVdW„ dWe+ƒZAG dXdY„ dYe+ƒZBG dZd[„ d[eBƒZCG d\d]„ d]eBƒZDG d^d_„ d_eBƒZEG d`da„ dae+ƒZFG dbdc„ dce+ƒZGG ddde„ dee+ƒZHG dfdg„ dge+ƒZIG dhdi„ die+ƒZJG djdk„ dke+ƒZKG dldm„ dme+ƒZLdnS )pz6SQL function API, factories, and built-in functions.

é   )Ú
annotation)Ú	operators)Úschema)Úsqltypes)Úutil)ÚColumnCollection)Ú
Executable)Ú_clone©Ú_literal_as_binds)Ú_type_from_args)ÚBindParameter)ÚCast)Ú
ClauseList)ÚColumnElement)ÚExtract©ÚFunctionFilter)ÚGrouping)Úliteral_column©ÚOver©ÚWithinGroup©ÚAlias)Ú
FromClause)ÚSelect)ÚVisitableTypeé   Ú_defaultc                 C   s   t | }||| < dS )zûAssociate a callable with a particular func. name.

    This is normally called by _GenericMeta, but is also
    available by itself so that a non-Function construct
    can be associated with the :data:`.func` accessor (i.e.
    CAST, EXTRACT).

    N)Ú	_registry)Ú
identifierÚfnÚpackageÚreg© r&   úJ/var/www/html/env/lib/python3.10/site-packages/sqlalchemy/sql/functions.pyÚregister_function(   s   	r(   c                       s¾   e Zd ZdZdZdd„ Zdd„ Zedd„ ƒZe	j
d	d
„ ƒZd'dd„Zdd„ Zdd„ Zedd„ ƒZdd„ Zefdd„Zdd„ Zd(dd„Zdd„ Zdd „ Zd!d"„ Zd)d#d$„Zd)‡ fd%d&„	Z‡  ZS )*ÚFunctionElementa<  Base for SQL function-oriented constructs.

    .. seealso::

        :class:`.Function` - named SQL function.

        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.

        :class:`.GenericFunction` - allows creation of registered function
        types.

    r&   c                    s.   ‡ fdd„|D ƒ}t |tjddœŽ ¡ ˆ _dS )z/Construct a :class:`.FunctionElement`.
        c                    ó   g | ]}t |ˆ jƒ‘qS r&   ©r   Úname©Ú.0Úc©Úselfr&   r'   Ú
<listcomp>I   ó    z,FunctionElement.__init__.<locals>.<listcomp>T©ÚoperatorÚgroup_contentsN)r   r   Úcomma_opÚ
self_groupÚclause_expr)r1   ÚclausesÚkwargsÚargsr&   r0   r'   Ú__init__F   s   ÿþzFunctionElement.__init__c                 C   s   |  | ||¡S ©N)Ú_execute_function)r1   Ú
connectionÚmultiparamsÚparamsr&   r&   r'   Ú_execute_on_connectionN   s   z&FunctionElement._execute_on_connectionc                 C   s   t |  d¡ƒS )a2  The set of columns exported by this :class:`.FunctionElement`.

        Function objects currently have no result column names built in;
        this method returns a single-element column collection with
        an anonymously named column.

        An interim approach to providing named columns for a function
        as a FROM clause is to build a :func:`.select` with the
        desired columns::

            from sqlalchemy.sql import column

            stmt = select([column('x'), column('y')]).                select_from(func.myfunction())


        N)r   Úlabelr0   r&   r&   r'   ÚcolumnsQ   s   zFunctionElement.columnsc                 C   ó   | j jS )z}Return the underlying :class:`.ClauseList` which contains
        the arguments for this :class:`.FunctionElement`.

        )r9   Úelementr0   r&   r&   r'   r:   f   s   zFunctionElement.clausesNc                 C   s   t | ||||d�S )a·  Produce an OVER clause against this function.

        Used against aggregate or so-called "window" functions,
        for database backends that support window functions.

        The expression::

            func.row_number().over(order_by='x')

        is shorthand for::

            from sqlalchemy import over
            over(func.row_number(), order_by='x')

        See :func:`~.expression.over` for a full description.

        )Úpartition_byÚorder_byÚrowsÚrange_r   )r1   rH   rI   rJ   rK   r&   r&   r'   Úovern   s   ûzFunctionElement.overc                 G   s   t | g|¢R Ž S )ay  Produce a WITHIN GROUP (ORDER BY expr) clause against this function.

        Used against so-called "ordered set aggregate" and "hypothetical
        set aggregate" functions, including :class:`.percentile_cont`,
        :class:`.rank`, :class:`.dense_rank`, etc.

        See :func:`~.expression.within_group` for a full description.

        .. versionadded:: 1.1


        r   )r1   rI   r&   r&   r'   Úwithin_groupˆ   s   zFunctionElement.within_groupc                 G   s   |s| S t | g|¢R Ž S )aæ  Produce a FILTER clause against this function.

        Used against aggregate and window functions,
        for database backends that support the "FILTER" clause.

        The expression::

            func.count(1).filter(True)

        is shorthand for::

            from sqlalchemy import funcfilter
            funcfilter(func.count(1), True)

        .. versionadded:: 1.0.0

        .. seealso::

            :class:`.FunctionFilter`

            :func:`.funcfilter`


        r   )r1   Ú	criterionr&   r&   r'   Úfilter—   s   zFunctionElement.filterc                 C   rF   r>   )r:   Ú_from_objectsr0   r&   r&   r'   rP   ´   s   zFunctionElement._from_objectsc                 K   s   | j fS r>   )r9   ©r1   r;   r&   r&   r'   Úget_children¸   s   zFunctionElement.get_childrenc                 K   s,   || j fi |¤Ž| _ |  ¡  tj | ¡ d S r>   )r9   Ú_reset_exportedr)   r:   Ú_reset)r1   ÚcloneÚkwr&   r&   r'   Ú_copy_internals»   s   zFunctionElement._copy_internalsc                 C   s   dS )a  For types that define their return type as based on the criteria
        within a WITHIN GROUP (ORDER BY) expression, called by the
        :class:`.WithinGroup` construct.

        Returns None by default, in which case the function's normal ``.type``
        is used.

        Nr&   )r1   rM   r&   r&   r'   Úwithin_group_typeÀ   s   
z!FunctionElement.within_group_typeFc                 C   s
   t | |ƒS )a_  Produce a :class:`.Alias` construct against this
        :class:`.FunctionElement`.

        This construct wraps the function in a named alias which
        is suitable for the FROM clause, in the style accepted for example
        by PostgreSQL.

        e.g.::

            from sqlalchemy.sql import column

            stmt = select([column('data_view')]).\
                select_from(SomeTable).\
                select_from(func.unnest(SomeTable.data).alias('data_view')
            )

        Would produce:

        .. sourcecode:: sql

            SELECT data_view
            FROM sometable, unnest(sometable.data) AS data_view

        .. versionadded:: 0.9.8 The :meth:`.FunctionElement.alias` method
           is now supported.  Previously, this method's behavior was
           undefined and did not behave consistently across versions.

        r   )r1   r,   Úflatr&   r&   r'   ÚaliasÌ   s   
zFunctionElement.aliasc                 C   s&   t | gƒ}| jr|jdi | j¤Ž}|S )z¶Produce a :func:`~.expression.select` construct
        against this :class:`.FunctionElement`.

        This is shorthand for::

            s = select([function_element])

        Nr&   )r   Ú_execution_optionsÚexecution_options)r1   Úsr&   r&   r'   Úselectì   s   
	zFunctionElement.selectc                 C   s   |   ¡  ¡  ¡ S )ar  Execute this :class:`.FunctionElement` against an embedded
        'bind' and return a scalar value.

        This first calls :meth:`~.FunctionElement.select` to
        produce a SELECT construct.

        Note that :class:`.FunctionElement` can be passed to
        the :meth:`.Connectable.scalar` method of :class:`.Connection`
        or :class:`.Engine`.

        )r^   ÚexecuteÚscalarr0   r&   r&   r'   r`   ú   s   zFunctionElement.scalarc                 C   s   |   ¡  ¡ S )aY  Execute this :class:`.FunctionElement` against an embedded
        'bind'.

        This first calls :meth:`~.FunctionElement.select` to
        produce a SELECT construct.

        Note that :class:`.FunctionElement` can be passed to
        the :meth:`.Connectable.execute` method of :class:`.Connection`
        or :class:`.Engine`.

        )r^   r_   r0   r&   r&   r'   r_     s   zFunctionElement.executec                 C   s   t d ||| jd|d�S )NT)Ú_compared_to_operatorÚ_compared_to_typeÚuniqueÚtype_)r   Útype©r1   r5   Úobjrd   r&   r&   r'   Ú_bind_param  s   úzFunctionElement._bind_paramc                    s2   |t ju rt| jtjƒrt| ƒS tt| ƒj	|d�S )N)Úagainst)
r   ÚgetitemÚ
isinstancere   r   ÚARRAYr   Úsuperr)   r8   )r1   ri   ©Ú	__class__r&   r'   r8      s
   ÿzFunctionElement.self_group)NNNN)NFr>   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpackagenamesr=   rC   ÚpropertyrE   r   Úmemoized_propertyr:   rL   rM   rO   rP   rR   r	   rW   rX   rZ   r^   r`   r_   rh   r8   Ú__classcell__r&   r&   rn   r'   r)   5   s.    




 

r)   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú_FunctionGeneratorz;Generate :class:`.Function` objects based on getattr calls.c                 K   s   g | _ || _d S r>   )Ú_FunctionGenerator__namesÚopts)r1   rz   r&   r&   r'   r=   0  s   
z_FunctionGenerator.__init__c                 C   sj   |  d¡rz| j| W S  ty   t|ƒ‚w | d¡r"|dd… }tdi | j¤Ž}t| jƒ|g |_|S )NÚ__Ú_é    éÿÿÿÿr&   )	Ú
startswithÚ__dict__ÚKeyErrorÚAttributeErrorÚendswithrx   rz   Úlistry   )r1   r,   Úfr&   r&   r'   Ú__getattr__4  s   
ÿ
z_FunctionGenerator.__getattr__c                 O   s¦   | j  ¡ }| |¡ t| jƒ}|dkr| j\}}n|dkr&d| jd }}nd }|d ur>t|  |¡}|d ur>||i |¤ŽS t| jd g|¢R d| jdd… i|¤ŽS )Nr   r   r    r}   r~   rt   )rz   ÚcopyÚupdateÚlenry   r!   ÚgetÚFunction)r1   r/   r;   ÚoÚtokensr$   ÚfnameÚfuncr&   r&   r'   Ú__call__B  s*   


ÿÿÿÿz_FunctionGenerator.__call__N)rp   rq   rr   rs   r=   r†   r�   r&   r&   r&   r'   rx   -  s
    rx   F)Úgroupc                   @   s&   e Zd ZdZdZdd„ Zddd„ZdS )	r‹   aY  Describe a named SQL function.

    See the superclass :class:`.FunctionElement` for a description
    of public methods.

    .. seealso::

        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.

        :class:`.GenericFunction` - allows creation of registered function
        types.

    Úfunctionc                 O   sV   |  dd¡pg | _|| _| dd¡| _t | dd¡¡| _tj	| g|¢R i |¤Ž dS )z–Construct a :class:`.Function`.

        The :data:`.func` construct is normally used to construct
        new :class:`.Function` instances.

        rt   NÚbindrd   )
Úpoprt   r,   rŠ   Ú_bindr   Úto_instancere   r)   r=   )r1   r,   r:   rV   r&   r&   r'   r=   ´  s
   zFunction.__init__Nc                 C   s   t | j||| j|dd�S )NT)ra   rb   rd   rc   )r   r,   re   rf   r&   r&   r'   rh   Â  s   úzFunction._bind_paramr>   )rp   rq   rr   rs   Ú__visit_name__r=   rh   r&   r&   r&   r'   r‹   ¢  s
    r‹   c                       s   e Zd Z‡ fdd„Z‡  ZS )Ú_GenericMetac                    sr   t j| jvr-| d|¡ | _}| d|¡ | _}| dd¡}d|v r'|d | _t|| |ƒ t	t
| ƒ |||¡ d S )Nr,   r"   r$   r    Ú__return_type__)r   Ú	AnnotatedÚ__mro__rŠ   r,   r"   r”   re   r(   rm   r˜   r=   )ÚclsÚclsnameÚbasesÚclsdictr,   r"   r$   rn   r&   r'   r=   Î  s   
z_GenericMeta.__init__)rp   rq   rr   r=   rw   r&   r&   rn   r'   r˜   Í  s    r˜   c                   @   ó   e Zd ZdZdZdd„ ZdS )ÚGenericFunctiona¤  Define a 'generic' function.

    A generic function is a pre-established :class:`.Function`
    class that is instantiated automatically when called
    by name from the :data:`.func` attribute.    Note that
    calling any name from :data:`.func` has the effect that
    a new :class:`.Function` instance is created automatically,
    given that name.  The primary use case for defining
    a :class:`.GenericFunction` class is so that a function
    of a particular name may be given a fixed return type.
    It can also include custom argument parsing schemes as well
    as additional methods.

    Subclasses of :class:`.GenericFunction` are automatically
    registered under the name of the class.  For
    example, a user-defined function ``as_utc()`` would
    be available immediately::

        from sqlalchemy.sql.functions import GenericFunction
        from sqlalchemy.types import DateTime

        class as_utc(GenericFunction):
            type = DateTime

        print select([func.as_utc()])

    User-defined generic functions can be organized into
    packages by specifying the "package" attribute when defining
    :class:`.GenericFunction`.   Third party libraries
    containing many functions may want to use this in order
    to avoid name conflicts with other systems.   For example,
    if our ``as_utc()`` function were part of a package
    "time"::

        class as_utc(GenericFunction):
            type = DateTime
            package = "time"

    The above function would be available from :data:`.func`
    using the package name ``time``::

        print select([func.time.as_utc()])

    A final option is to allow the function to be accessed
    from one name in :data:`.func` but to render as a different name.
    The ``identifier`` attribute will override the name used to
    access the function as loaded from :data:`.func`, but will retain
    the usage of ``name`` as the rendered name::

        class GeoBuffer(GenericFunction):
            type = Geometry
            package = "geo"
            name = "ST_Buffer"
            identifier = "buffer"

    The above function will render as follows::

        >>> print func.geo.buffer()
        ST_Buffer()

    Tc                    sv   |  dd ¡}|d u r‡ fdd„|D ƒ}g ˆ _| dd ¡ˆ _t|tjddœŽ ¡ ˆ _t	 
|  dd ¡p6tˆ dd ƒ¡ˆ _d S )	NÚ_parsed_argsc                    r*   r&   r+   r-   r0   r&   r'   r2     r3   z,GenericFunction.__init__.<locals>.<listcomp>r“   Tr4   rd   re   )r”   rt   rŠ   r•   r   r   r7   r8   r9   r   r–   Úgetattrre   )r1   r<   r;   Úparsed_argsr&   r0   r'   r=     s   ÿþ
ÿzGenericFunction.__init__N)rp   rq   rr   rs   Úcoerce_argumentsr=   r&   r&   r&   r'   r¡   Ú  s    >r¡   ÚcastÚextractc                   @   s0   e Zd ZdZe ¡ Zd Zdd„ Ze	dd„ ƒZ
dS )Ú
next_valuea  Represent the 'next value', given a :class:`.Sequence`
    as its single argument.

    Compiles into the appropriate function on each backend,
    or will raise NotImplementedError if used on a backend
    that does not provide support for sequences.

    c                 K   s,   t |tjƒs
J dƒ‚| dd ¡| _|| _d S )Nz0next_value() accepts a Sequence object as input.r“   )rk   r   ÚSequencerŠ   r•   Úsequence)r1   ÚseqrV   r&   r&   r'   r=   :  s   ÿþ
znext_value.__init__c                 C   s   g S r>   r&   r0   r&   r&   r'   rP   A  s   znext_value._from_objectsN)rp   rq   rr   rs   r   ÚIntegerre   r,   r=   ru   rP   r&   r&   r&   r'   r¨   -  s    	r¨   c                   @   s   e Zd Zdd„ ZdS )ÚAnsiFunctionc                 K   s   t j| fi |¤Ž d S r>   ©r¡   r=   rQ   r&   r&   r'   r=   G  s   zAnsiFunction.__init__N)rp   rq   rr   r=   r&   r&   r&   r'   r­   F  s    r­   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚReturnTypeFromArgszADefine a function whose return type is the same as its arguments.c                    sD   ‡ fdd„|D ƒ}|  dt|ƒ¡ ||d< ttˆ ƒj|i |¤Ž d S )Nc                    r*   r&   r+   r-   r0   r&   r'   r2   O  r3   z/ReturnTypeFromArgs.__init__.<locals>.<listcomp>rd   r¢   )Ú
setdefaultr   rm   r¯   r=   )r1   r<   r;   rn   r0   r'   r=   N  s   zReturnTypeFromArgs.__init__)rp   rq   rr   rs   r=   rw   r&   r&   rn   r'   r¯   K  s    r¯   c                   @   ó   e Zd ZdS )ÚcoalesceN©rp   rq   rr   r&   r&   r&   r'   r²   U  ó    r²   c                   @   r±   )ÚmaxNr³   r&   r&   r&   r'   rµ   Y  r´   rµ   c                   @   r±   )ÚminNr³   r&   r&   r&   r'   r¶   ]  r´   r¶   c                   @   r±   )ÚsumNr³   r&   r&   r&   r'   r·   a  r´   r·   c                   @   ó   e Zd ZejZdS )ÚnowN©rp   rq   rr   r   ÚDateTimere   r&   r&   r&   r'   r¹   e  ó    
r¹   c                   @   r¸   )ÚconcatN©rp   rq   rr   r   ÚStringre   r&   r&   r&   r'   r½   i  r¼   r½   c                   @   s   e Zd ZejZdd„ ZdS )Úchar_lengthc                 K   s   t j| |fi |¤Ž d S r>   r®   )r1   Úargr;   r&   r&   r'   r=   p  s   zchar_length.__init__N)rp   rq   rr   r   r¬   re   r=   r&   r&   r&   r'   rÀ   m  s    rÀ   c                   @   r±   )ÚrandomNr³   r&   r&   r&   r'   rÂ   t  r´   rÂ   c                       s(   e Zd ZdZejZd‡ fdd„	Z‡  ZS )Úcounta©  The ANSI COUNT aggregate function.  With no arguments,
    emits COUNT \*.

    E.g.::

        from sqlalchemy import func
        from sqlalchemy import select
        from sqlalchemy import table, column

        my_table = table('some_table', column('id'))

        stmt = select([func.count()]).select_from(my_table)

    Executing ``stmt`` would emit::

        SELECT count(*) AS count_1
        FROM some_table


    Nc                    s,   |d u rt dƒ}tt| ƒj|fi |¤Ž d S )NÚ*)r   rm   rÃ   r=   )r1   Ú
expressionr;   rn   r&   r'   r=   �  s   zcount.__init__r>   )	rp   rq   rr   rs   r   r¬   re   r=   rw   r&   r&   rn   r'   rÃ   x  s    rÃ   c                   @   r¸   )Úcurrent_dateN)rp   rq   rr   r   ÚDatere   r&   r&   r&   r'   rÆ   •  r¼   rÆ   c                   @   r¸   )Úcurrent_timeN)rp   rq   rr   r   ÚTimere   r&   r&   r&   r'   rÈ   ™  r¼   rÈ   c                   @   r¸   )Úcurrent_timestampNrº   r&   r&   r&   r'   rÊ   �  r¼   rÊ   c                   @   r¸   )Úcurrent_userNr¾   r&   r&   r&   r'   rË   ¡  r¼   rË   c                   @   r¸   )Ú	localtimeNrº   r&   r&   r&   r'   rÌ   ¥  r¼   rÌ   c                   @   r¸   )ÚlocaltimestampNrº   r&   r&   r&   r'   rÍ   ©  r¼   rÍ   c                   @   r¸   )Úsession_userNr¾   r&   r&   r&   r'   rÎ   ­  r¼   rÎ   c                   @   r¸   )ÚsysdateNrº   r&   r&   r&   r'   rÏ   ±  r¼   rÏ   c                   @   r¸   )ÚuserNr¾   r&   r&   r&   r'   rÐ   µ  r¼   rÐ   c                       s&   e Zd ZdZejZ‡ fdd„Z‡  ZS )Ú	array_aggaª  support for the ARRAY_AGG function.

    The ``func.array_agg(expr)`` construct returns an expression of
    type :class:`.types.ARRAY`.

    e.g.::

        stmt = select([func.array_agg(table.c.values)[2:5]])

    .. versionadded:: 1.1

    .. seealso::

        :func:`.postgresql.array_agg` - PostgreSQL-specific version that
        returns :class:`.postgresql.ARRAY`, which has PG-specific operators
        added.

    c                    sp   dd„ |D ƒ}|  dtj¡}d|vr't|ƒ}t|tjƒr!||d< n||ƒ|d< ||d< tt| ƒj|i |¤Ž d S )Nc                 S   s   g | ]}t |ƒ‘qS r&   r
   r-   r&   r&   r'   r2   Ð  s    z&array_agg.__init__.<locals>.<listcomp>Ú_default_array_typerd   r¢   )r”   r   rl   r   rk   rm   rÑ   r=   )r1   r<   r;   Údefault_array_typeÚtype_from_argsrn   r&   r'   r=   Ï  s   
zarray_agg.__init__)	rp   rq   rr   rs   r   rl   re   r=   rw   r&   r&   rn   r'   rÑ   ¹  s    rÑ   c                   @   r    )ÚOrderedSetAggz­Define a function where the return type is based on the sort
    expression type as defined by the expression passed to the
    :meth:`.FunctionElement.within_group` method.Fc                 C   sB   | j j}t |j¡}| jrt|jƒdkrt 	|d j
¡S |d j
S )Nr   r}   )r9   rG   ÚsqlutilÚunwrap_order_byrI   Úarray_for_multi_clauser‰   r:   r   rl   re   )r1   rM   Úfunc_clausesrI   r&   r&   r'   rX   å  s
   
zOrderedSetAgg.within_group_typeN)rp   rq   rr   rs   rØ   rX   r&   r&   r&   r'   rÕ   Þ  s    rÕ   c                   @   ó   e Zd ZdZdS )Úmodea*  implement the ``mode`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression.

    .. versionadded:: 1.1

    N©rp   rq   rr   rs   r&   r&   r&   r'   rÛ   î  ó    rÛ   c                   @   ó   e Zd ZdZdZdS )Úpercentile_conta—  implement the ``percentile_cont`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`.types.ARRAY` of the sort
    expression's type.

    .. versionadded:: 1.1

    TN©rp   rq   rr   rs   rØ   r&   r&   r&   r'   rß   û  ó    rß   c                   @   rÞ   )Úpercentile_disca—  implement the ``percentile_disc`` ordered-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`.types.ARRAY` of the sort
    expression's type.

    .. versionadded:: 1.1

    TNrà   r&   r&   r&   r'   râ     rá   râ   c                   @   ó   e Zd ZdZe ¡ ZdS )Úranka!  Implement the ``rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Integer`.

    .. versionadded:: 1.1

    N©rp   rq   rr   rs   r   r¬   re   r&   r&   r&   r'   rä     ó    rä   c                   @   rã   )Ú
dense_ranka'  Implement the ``dense_rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Integer`.

    .. versionadded:: 1.1

    Nrå   r&   r&   r&   r'   rç   ,  ræ   rç   c                   @   rã   )Úpercent_ranka)  Implement the ``percent_rank`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Numeric`.

    .. versionadded:: 1.1

    N©rp   rq   rr   rs   r   ÚNumericre   r&   r&   r&   r'   rè   ;  ræ   rè   c                   @   rã   )Ú	cume_dista&  Implement the ``cume_dist`` hypothetical-set aggregate function.

    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.

    The return type of this function is :class:`.Numeric`.

    .. versionadded:: 1.1

    Nré   r&   r&   r&   r'   rë   J  ræ   rë   c                   @   rÚ   )ÚcubeaN  Implement the ``CUBE`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
            ).group_by(func.cube(table.c.col_1, table.c.col_2))

    .. versionadded:: 1.2

    NrÜ   r&   r&   r&   r'   rì   Y  rÝ   rì   c                   @   rÚ   )ÚrollupaN  Implement the ``ROLLUP`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
        ).group_by(func.rollup(table.c.col_1, table.c.col_2))

    .. versionadded:: 1.2

    NrÜ   r&   r&   r&   r'   rí   h  rÝ   rí   c                   @   rÚ   )Úgrouping_setsa%  Implement the ``GROUPING SETS`` grouping operation.

    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`.Select.group_by`::

        stmt = select(
            [func.sum(table.c.value), table.c.col_1, table.c.col_2]
        ).group_by(func.grouping_sets(table.c.col_1, table.c.col_2))

    In order to group by multiple sets, use the :func:`.tuple_` construct::

        from sqlalchemy import tuple_

        stmt = select(
            [
                func.sum(table.c.value),
                table.c.col_1, table.c.col_2,
                table.c.col_3]
        ).group_by(
            func.grouping_sets(
                tuple_(table.c.col_1, table.c.col_2),
                tuple_(table.c.value, table.c.col_3),
            )
        )


    .. versionadded:: 1.2

    NrÜ   r&   r&   r&   r'   rî   w  rÝ   rî   N)r    )Mrs   Ú r   r   r   r   r   rÖ   Úbaser   r   Úelementsr	   r   r   r   r   r   r   r   r   r   r   r   r   Ú
selectabler   r   r   Úvisitorsr   ÚdefaultdictÚdictr!   r(   r)   Úobjectrx   r�   Úmodifierr‹   r˜   Úwith_metaclassr¡   r¨   r­   r¯   r²   rµ   r¶   r·   r¹   r½   rÀ   rÂ   rÃ   rÆ   rÈ   rÊ   rË   rÌ   rÍ   rÎ   rÏ   rÐ   rÑ   rÕ   rÛ   rß   râ   rä   rç   rè   rë   rì   rí   rî   r&   r&   r&   r'   Ú<module>   s�   

 y,
E+
O

%