Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
contego / home / tvault / .virtenv / lib / python2.7 / site-packages / sqlalchemy / sql / functions.pyc
Size: Mime:
ó
‹EYc@sydZddlmZmZddlmZmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZmZmZddlmZddlmZdd	lmZdd
lmZejeƒZdd„Zd
eeefd„ƒYZ de!fd„ƒYZ"e"ƒZ#e"de$ƒZ%de fd„ƒYZ&defd„ƒYZ'dej(e'e&ƒfd„ƒYZ)ede	ƒede
ƒde)fd„ƒYZ*de)fd„ƒYZ+de)fd„ƒYZ,d e,fd!„ƒYZ-d"e,fd#„ƒYZ.d$e,fd%„ƒYZ/d&e,fd'„ƒYZ0d(e)fd)„ƒYZ1d*e)fd+„ƒYZ2d,e)fd-„ƒYZ3d.e)fd/„ƒYZ4d0e)fd1„ƒYZ5d2e+fd3„ƒYZ6d4e+fd5„ƒYZ7d6e+fd7„ƒYZ8d8e+fd9„ƒYZ9d:e+fd;„ƒYZ:d<e+fd=„ƒYZ;d>e+fd?„ƒYZ<d@e+fdA„ƒYZ=dBe+fdC„ƒYZ>dDS(Es6SQL function API, factories, and built-in functions.

i(tsqltypestschema(t
ExecutabletColumnCollection(t
ClauseListtCasttExtractt_literal_as_bindstliteral_columnt_type_from_argst
ColumnElementt_clonetOvert
BindParametertFunctionFilter(t
FromClausetSelecttAlias(t	operators(t
VisitableTypei(tutil(t
annotationt_defaultcCst|}|||<dS(sû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(t	_registry(t
identifiertfntpackagetreg((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytregister_functions	
tFunctionElementcBs¶eZdZdZd„Zd„Zed„ƒZej	d„ƒZ
ddd„Zd„Z
ed„ƒZd„Zed	„Zded
„Zd„Zd„Zd
„Zd„ZRS(s<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.

    cOsMg|D]}t||jƒ^q}tdtjdt|Œjƒ|_dS(s/Construct a :class:`.FunctionElement`.
        toperatortgroup_contentsN(RtnameRRtcomma_optTruet
self_grouptclause_expr(tselftclausestkwargstctargs((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt__init__8s%	cCs|j|||ƒS(N(t_execute_function(R%t
connectiontmultiparamstparams((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt_execute_on_connectionAscCst|jdƒƒS(s2The 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(RtlabeltNone(R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytcolumnsDscCs
|jjS(s}Return the underlying :class:`.ClauseList` which contains
        the arguments for this :class:`.FunctionElement`.

        (R$telement(R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR&YscCst|d|d|ƒS(sÖ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.

        .. versionadded:: 0.7

        tpartition_bytorder_by(R(R%R4R5((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytoverascGs|s
|St||ŒS(sæ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(R%t	criterion((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytfilterwscCs
|jjS(N(R&t
_from_objects(R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR9”scKs
|jfS(N(R$(R%R'((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytget_children˜scKs3||j||_|jƒtjj|ƒdS(N(R$t_reset_exportedRR&t_reset(R%tclonetkw((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt_copy_internals›s
cCs
t||ƒS(s_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(R%R tflat((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytalias scCs1t|gƒ}|jr-|j|j}n|S(s¶Produce a :func:`~.expression.select` construct
        against this :class:`.FunctionElement`.

        This is shorthand for::

            s = select([function_element])

        (Rt_execution_optionstexecution_options(R%ts((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pytselectÀs		cCs|jƒjƒjƒS(srExecute 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`.

        (REtexecutetscalar(R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRGÎscCs|jƒjƒS(sYExecute 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`.

        (RERF(R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRFÜsc	Cs"td|d|d|jdtƒS(Nt_compared_to_operatort_compared_to_typetunique(R
R1ttypeR"(R%Rtobj((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt_bind_paramês(N(t__name__t
__module__t__doc__tpackagenamesR*R/tpropertyR2Rtmemoized_propertyR&R1R6R8R9R:RR?tFalseRARERGRFRM(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR's 
					 			t_FunctionGeneratorcBs)eZdZd„Zd„Zd„ZRS(s;Generate :class:`.Function` objects based on getattr calls.cKsg|_||_dS(N(t_FunctionGenerator__namestopts(R%RW((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*òs	cCsŒ|jdƒrAy|j|SWq`tk
r=t|ƒ‚q`Xn|jdƒr`|dd!}nt|j}t|jƒ|g|_|S(Nt__t_iiÿÿÿÿ(	t
startswitht__dict__tKeyErrortAttributeErrortendswithRURWtlistRV(R%R tf((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt__getattr__ös
cOsÔ|jjƒ}|j|ƒt|jƒ}|dkrI|j\}}n)|dkrld|jd}}nd}|dk	r­t|j|ƒ}|dk	r­|||ŽSnt|jdd|jdd!||ŽS(NiiRiiÿÿÿÿRQ(	RWtcopytupdatetlenRVR1RtgettFunction(R%R(R'tottokensRtfnametfunc((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt__call__s
(RNRORPR*RaRk(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRUïs		tgroupRfcBs&eZdZdZd„Zd„ZRS(sYDescribe 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.

    tfunctioncOsn|jddƒpg|_||_|jddƒ|_tj|jddƒƒ|_t	j
|||ŽdS(s–Construct a :class:`.Function`.

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

        RQtbindttype_N(tpopR1RQR Ret_bindRtto_instanceRKRR*(R%R R&R>((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*ys
	c	Cs%t|j|d|d|jdtƒS(NRHRIRJ(R
R RKR"(R%RRL((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRM‡s	(RNRORPt__visit_name__R*RM(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRfgs	t_GenericMetacBseZd„ZRS(cCs¥tj|jkr…|jd|ƒ|_}|jd|ƒ|_}|jddƒ}d|krr|d|_nt|||ƒnt	t
|ƒj|||ƒdS(NR RRRt__return_type__(Rt	Annotatedt__mro__ReR RRpRKRtsuperRtR*(tclstclsnametbasestclsdictR RR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*s(RNROR*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRtŽstGenericFunctioncBseZdZeZd„ZRS(sI
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()

    .. versionadded:: 0.8 :class:`.GenericFunction` now supports
       automatic registration of new functions as well as package
       and custom naming support.

    .. versionchanged:: 0.8 The attribute name ``type`` is used
       to specify the function's return type at the class level.
       Previously, the name ``__return_type__`` was used.  This
       name is still recognized for backwards-compatibility.

    cOs¶|jddƒ}|dkr@g|D]}t|ƒ^q%}ng|_|jddƒ|_tdtjdt	|Œj
ƒ|_tj
|jddƒp©t|ddƒƒ|_dS(Nt_parsed_argsRnRRRoRK(RpR1RRQReRqRRR!R"R#R$RRrtgetattrRK(R%R)R'tparsed_argsR(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*ås"		(RNRORPR"tcoerce_argumentsR*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR}›sFtcasttextractt
next_valuecBs8eZdZejƒZdZd„Zed„ƒZ	RS(sRepresent 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.

    R„cKs@t|tjƒstdƒ‚|jddƒ|_||_dS(Ns0next_value() accepts a Sequence object as input.Rn(t
isinstanceRtSequencetAssertionErrorReR1Rqtsequence(R%tseqR>((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*s	cCsgS(N((R%((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR9s(
RNRORPRtIntegerRKR R*RRR9(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR„õs
	tAnsiFunctioncBseZd„ZRS(cKstj||dS(N(R}R*(R%R'((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*
s(RNROR*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR‹stReturnTypeFromArgscBseZdZd„ZRS(sADefine a function whose return type is the same as its arguments.cOsVg|D]}t|ƒ^q}|jdt|ƒƒ||d<tj|||ŽdS(NRoR~(Rt
setdefaultR	R}R*(R%R)R'R(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*s
(RNRORPR*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRŒstcoalescecBseZRS((RNRO(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRŽstmaxcBseZRS((RNRO(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRstmincBseZRS((RNRO(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR#stsumcBseZRS((RNRO(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR‘'stnowcBseZejZRS((RNRORtDateTimeRK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR’+stconcatcBseZejZRS((RNRORtStringRK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR”/stchar_lengthcBseZejZd„ZRS(cKstj|||dS(N(R}R*(R%targR'((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*6s(RNRORRŠRKR*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR–3s	trandomcBseZRS((RNRO(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR˜:stcountcBs#eZdZejZdd„ZRS(sPThe ANSI COUNT aggregate function.  With no arguments,
    emits COUNT \*.

    cKs2|dkrtdƒ}ntj|||dS(Nt*(R1RR}R*(R%t
expressionR'((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR*EsN(RNRORPRRŠRKR1R*(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR™>s	tcurrent_datecBseZejZRS((RNRORtDateRK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRœKstcurrent_timecBseZejZRS((RNRORtTimeRK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyRžOstcurrent_timestampcBseZejZRS((RNRORR“RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR Sstcurrent_usercBseZejZRS((RNRORR•RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR¡Wst	localtimecBseZejZRS((RNRORR“RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR¢[stlocaltimestampcBseZejZRS((RNRORR“RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR£_stsession_usercBseZejZRS((RNRORR•RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR¤cstsysdatecBseZejZRS((RNRORR“RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR¥gstusercBseZejZRS((RNRORR•RK(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyR¦ksN(?RPtRRtbaseRRtelementsRRRRRR	R
RRR
Rt
selectableRRRRtvisitorsRRRtdefaultdicttdictRRRtobjectRURjRTtmodifierRfRttwith_metaclassR}R„R‹RŒRŽRRR‘R’R”R–R˜R™RœRžR R¡R¢R£R¤R¥R¦(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/sqlalchemy/sql/functions.pyt<module>
sPL
È+	J'
"V