ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 4]c@sdZddlmZddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z dd l mZdd l mZdd l mZdd l mZdd lmZddlmZddlmZddlmZddlmZddlmZdZdZdZedZedZedZ dZ!ej"defdYZ#dej$e#fdYZ%de%fd YZ&d!e#fd"YZ'd#ee#fd$YZ(d%e%fd&YZ)d'e%fd(YZ*d)e%fd*YZ+d+e#fd,YZ,d-e,e%fd.YZ-e-j.Z.e-j/Z/d/e,e%fd0YZ0d1e%fd2YZ1ed3Z2d4e%fd5YZ3d6e%fd7YZ4d8e%fd9YZ5d:e%fd;YZ6d<e%fd=YZ7d>e%fd?YZ8d@e8fdAYZ9dBe8fdCYZ:dDe%fdEYZ;dFe%fdGYZ<dHe;fdIYZ=dJe%fdKYZ>ej?dLZ@ej?dMZAdNe%fdOYZBdPe%fdQYZCdRe%fdSYZDdTe%fdUYZEdVee%fdWYZFdXe%fdYYZGdZee#fd[YZHd\eHfd]YZId^eHfd_YZJd`eHfdaYZKdbejLejMfdcYZNddeNfdeYZOdfeOfdgYZPdheOfdiYZQdjeQfdkYZReRdlZSeOZTdmeOfdnYZUdoZVdpZWdqZXdrZYdsZZdtZ[ej\dudvZ]dwZ^dxZ_dyZ`dzZad{Zbd|Zcd}Zdd~ZeedZfdZgdZhejiedZjdZkdZldZmdZneedZoejpdejqZrdZsdZtdZuedZvde fdYZwdS(upCore SQL expression elements, including :class:`.ClauseElement`, :class:`.ColumnElement`, and derived classes. i(tunicode_literalsNi(t operators(ttype_api(t Annotated(t _generative(t Executable(t Immutable(tNO_ARG(tPARSE_AUTOCOMMIT(tcloned_traverse(ttraverse(t Visitablei(texc(t inspection(tutilcKs |jS(N(t_clone(telementtkw((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR$scCstj|d||fS(Nu.. warning:: The %s argument to %s can be passed as a Python string argument, which will be treated as **trusted SQL text** and rendered as given. **DO NOT PASS UNTRUSTED INPUT TO THIS PARAMETER**.(Rtadd_parameter_text(t paramnametmeth_rstt param_rst((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_document_text_coercion(scCs.t|}t|t|tjd|jS(uReturn the clause ``expression COLLATE collation``. e.g.:: collate(mycolumn, 'utf8_bin') produces:: mycolumn COLLATE utf8_bin The collation expression is also quoted if it is a case sensitive identifier, e.g. contains uppercase characters. .. versionchanged:: 1.2 quoting is automatically applied to COLLATE expressions if they are case sensitive. ttype_(t_literal_as_bindstBinaryExpressiontCollationClauseRtcollatettype(t expressiont collationtexpr((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR6s cCs"t|}|j||d|S(uEProduce a ``BETWEEN`` predicate clause. E.g.:: from sqlalchemy import between stmt = select([users_table]).where(between(users_table.c.id, 5, 7)) Would produce SQL resembling:: SELECT id, name FROM user WHERE id BETWEEN :id_1 AND :id_2 The :func:`.between` function is a standalone version of the :meth:`.ColumnElement.between` method available on all SQL expressions, as in:: stmt = select([users_table]).where(users_table.c.id.between(5, 7)) All arguments passed to :func:`.between`, including the left side column expression, are coerced from Python scalar values if a the value is not a :class:`.ColumnElement` subclass. For example, three fixed values can be compared as in:: print(between(5, 3, 7)) Which would produce:: :param_1 BETWEEN :param_2 AND :param_3 :param expr: a column expression, typically a :class:`.ColumnElement` instance or alternatively a Python scalar expression to be coerced into a column expression, serving as the left side of the ``BETWEEN`` expression. :param lower_bound: a column or Python scalar expression serving as the lower bound of the right side of the ``BETWEEN`` expression. :param upper_bound: a column or Python scalar expression serving as the upper bound of the right side of the ``BETWEEN`` expression. :param symmetric: if True, will render " BETWEEN SYMMETRIC ". Note that not all databases support this syntax. .. versionadded:: 0.9.5 .. seealso:: :meth:`.ColumnElement.between` t symmetric(Rtbetween(Rt lower_boundt upper_boundR ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR!Os2 cCstd|d|dtS(uReturn a literal clause, bound to a bind parameter. Literal clauses are created automatically when non- :class:`.ClauseElement` objects (such as strings, ints, dates, etc.) are used in a comparison operation with a :class:`.ColumnElement` subclass, such as a :class:`~sqlalchemy.schema.Column` object. Use this function to force the generation of a literal clause, which will be created as a :class:`BindParameter` with a bound value. :param value: the value to be bound. Can be any Python object supported by the underlying DB-API, or is translatable via the given type argument. :param type\_: an optional :class:`~sqlalchemy.types.TypeEngine` which will provide bind-parameter translation for this literal. RtuniqueN(t BindParametertNonetTrue(tvalueR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytliteralsc Cst|dd|dtdtS(uwCreate an 'OUT' parameter for usage in functions (stored procedures), for databases which support them. The ``outparam`` can be used like a regular function parameter. The "output" value will be available from the :class:`~sqlalchemy.engine.ResultProxy` object via its ``out_parameters`` attribute, which returns a dictionary containing the values. RR$t isoutparamN(R%R&tFalseR'(tkeyR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytoutparams cCstjt|S(uReturn a negation of the given clause, i.e. ``NOT(clause)``. The ``~`` operator is also overloaded on all :class:`.ColumnElement` subclasses to produce the same result. (RtinvR(tclause((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytnot_st ClauseElementcBseZdZdZiZeZgZdZ dZ eZ e Z dZdZeZdZedZejdZdZdZdZdedZd Zd Zd Zd Zd ZedZ dZ!ddZ"ej#ddddZ$dZ%dZ&ej'dddZ(ej'dddZ)dZ*dZ+dZ,e,Z-dZ.RS(uSBase class for elements of a programmatically constructed SQL expression. uclausecCsT|jj|j}|jj|_tjj|tjj|||_ |S(uCreate a shallow copy of this ClauseElement. This method may be used by a generative API. Its also used as part of the "deep" copy afforded by a traversal that combines the _copy_internals() method. ( t __class__t__new__t__dict__tcopyR1t _cloned_sett_resett ColumnElementt comparatort _is_clone_of(tselftc((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs  cCs|jS(u.return the 'constructor' for this ClauseElement. This is for the purposes for creating a new object of this type. Usually, its just the element's __class__. However, the "Annotated" version of the object overrides to return the class of its proxied element. (R2(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _constructors cCs?tj}|}x&|dk r:|j||j}qW|S(uReturn the set consisting all cloned ancestors of this ClauseElement. Includes this ClauseElement. This accessor tends to be used for FromClause objects to identify 'equivalent' FROM clauses, regardless of transformative operations. N(Rt column_setR&taddR:(R;tstf((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR6s   cCs#|jj}|jdd|S(Nu _is_clone_of(R4R5tpopR&(R;td((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt __getstate__scCs t||S(ugreturn a copy of this ClauseElement with annotations updated by the given dictionary. (R(R;tvalues((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _annotatescCs t||S(uhreturn a copy of this ClauseElement with annotations replaced by the given dictionary. (R(R;RE((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_with_annotationsscCs|r|jS|SdS(ureturn a copy of this :class:`.ClauseElement` with annotations removed. :param values: optional tuple of individual values to remove. N(R(R;REtclone((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _deannotate s cCs/|jr|j|||Stj|dS(N(tsupports_executiont_execute_clauseelementR tObjectNotExecutableError(R;t connectiont multiparamstparams((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_execute_on_connections cOs|jt||S(uReturn a copy with :func:`bindparam()` elements replaced. Same functionality as ``params()``, except adds `unique=True` to affected bind parameters so that multiple statements can be used. (t_paramsR'(R;t optionaldicttkwargs((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt unique_params#scOs|jt||S(uReturn a copy with :func:`bindparam()` elements replaced. Returns a copy of this ClauseElement with :func:`bindparam()` elements replaced with values taken from the given dictionary:: >>> clause = column('x') + bindparam('foo') >>> print clause.compile().params {'foo':None} >>> print clause.params({'foo':7}).compile().params {'foo':7} (RQR+(R;RRRS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRO-s csst|dkr&j|dn$t|dkrJtjdnfd}t|ii|d6S(Niiu9params() takes zero or one positional dictionary argumentcsB|jkr+|j|_t|_nr>|jndS(N(R,R(R+trequiredt_convert_to_unique(tbind(RSR$(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytvisit_bindparamDs  u bindparam(tlentupdateR t ArgumentErrorR (R;R$RRRSRX((RSR$sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRQ<s cKs ||kS(uTCompare this ClauseElement to the given ClauseElement. Subclasses should override the default behavior, which is a straight identity comparison. \**kw are arguments consumed by subclass compare() methods and may be used to modify the criteria for comparison. (see :class:`.ColumnElement`) ((R;totherR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytcompareMs cKsdS(utReassign internal elements to be clones of themselves. Called during a copy-and-traverse operation on newly shallow-copied elements to create a deep copy. The given clone function should be used, which may be applying additional transformations to the element (i.e. replacement traversal, cloned traversal, annotations). N((R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_copy_internalsZs cKsgS(uReturn immediate child elements of this :class:`.ClauseElement`. This is used for visit traversal. \**kwargs may contain flags that change the collection that is returned, for example to return a subset of items in order to cut down on larger traversals, or to return child items from a different context (such as schema-level collections instead of clause-level). ((R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt get_childrengs cCs|S(uaApply a 'grouping' to this :class:`.ClauseElement`. This method is overridden by subclasses to return a "grouping" construct, i.e. parenthesis. In particular it's used by "binary" expressions to provide a grouping around themselves when placed into a larger expression, as well as by :func:`.select` constructs when placed into the FROM clause of another :func:`.select`. (Note that subqueries should be normally created using the :meth:`.Select.alias` method, as many platforms require nested SELECT statements to be named). As expressions are composed together, the application of :meth:`self_group` is automatic - end-user code should never need to use this method directly. Note that SQLAlchemy's clause constructs take operator precedence into account - so parenthesis might not be needed, for example, in an expression like ``x OR (y AND z)`` - AND takes precedence over OR. The base :meth:`self_group` method of :class:`.ClauseElement` just returns self. ((R;tagainst((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt self_groupususqlalchemy.engine.defaultcKs^|sH|r|j}qH|jr9|jj}|j}qH|j}n|j|d||S(u Compile this SQL expression. The return value is a :class:`~.Compiled` object. Calling ``str()`` or ``unicode()`` on the returned value will yield a string representation of the result. The :class:`~.Compiled` object also can return a dictionary of bind parameter names and values using the ``params`` accessor. :param bind: An ``Engine`` or ``Connection`` from which a ``Compiled`` will be acquired. This argument takes precedence over this :class:`.ClauseElement`'s bound engine, if any. :param column_keys: Used for INSERT and UPDATE statements, a list of column names which should be present in the VALUES clause of the compiled statement. If ``None``, all columns from the target table object are rendered. :param dialect: A ``Dialect`` instance from which a ``Compiled`` will be acquired. This argument takes precedence over the `bind` argument as well as this :class:`.ClauseElement`'s bound engine, if any. :param inline: Used for INSERT statements, for a dialect which does not support inline retrieval of newly generated primary key columns, will force the expression used to create the new primary key value to be rendered inline within the INSERT statement's VALUES clause. This typically refers to Sequence execution but may also refer to any server-side default generation function associated with a primary key `Column`. :param compile_kwargs: optional dictionary of additional parameters that will be passed through to the compiler within all "visit" methods. This allows any custom flag to be passed through to a custom compilation construct, for example. It is also used for the case of passing the ``literal_binds`` flag through:: from sqlalchemy.sql import table, column, select t = table('t', column('x')) s = select([t]).where(t.c.x == 5) print s.compile(compile_kwargs={"literal_binds": True}) .. versionadded:: 0.9.0 .. seealso:: :ref:`faq_sql_expression_string` RW(tdialectRWtStrCompileDialectt _compiler(R;tdefaultRWRbR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytcompiles7    cKs|j|||S(uNReturn a compiler appropriate for this ClauseElement, given a Dialect.(tstatement_compiler(R;RbR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRdscCs9tjrt|jSt|jjddSdS(Nuasciiubackslashreplace(Rtpy3ktstrRftunicodetencode(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__str__s u0.9uThe :meth:`.ClauseElement.__and__` method is deprecated and will be removed in a future release. Conjunctions should only be used from a :class:`.ColumnElement` subclass, e.g. :meth:`.ColumnElement.__and__`.cCs t||S(u*'and' at the ClauseElement level. (tand_(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__and__s uThe :meth:`.ClauseElement.__or__` method is deprecated and will be removed in a future release. Conjunctions should only be used from a :class:`.ColumnElement` subclass, e.g. :meth:`.ColumnElement.__or__`.cCs t||S(u)'or' at the ClauseElement level. (tor_(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__or__s cCs$t|dr|jS|jSdS(Nunegation_clause(thasattrtnegation_clauset_negate(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt __invert__scCs(t|jdtjdtjddS(NR`toperatortnegate(tUnaryExpressionRaRR.R&(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRss cCstddS(Nu+Boolean value of this clause is not defined(t TypeError(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__bool__scCsI|j}|dkr"tj|Sd|j|jjt||fSdS(Nu<%s.%s at 0x%x; %s>(t descriptionR&tobjectt__repr__t __module__R2t__name__tid(R;tfriendly((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR|s     N(/R~R}t__doc__t__visit_name__t _annotationsR+RJt _from_objectsR&RWR:t is_selectableR'tis_clause_elementRzt_order_by_label_elementt_is_from_containerRtpropertyR=Rtmemoized_propertyR6RDRFRGRIRPRTRORQR]R^R_Rat dependenciesRfRdRlt deprecatedRnRpRtRsRyt __nonzero__R|(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR1sT           @      R8cBsUeZdZdZeZgZdZdZ dZ dZ e Z dZe ZeZdZddZdZejdZejdZdZdZdZdd Zed Zed Zejd Zejd Z dZ!dZ"dZ#dedZ$eddZ%dZ&dZ'ejdZ(RS(u[Represent a column-oriented SQL expression suitable for usage in the "columns" clause, WHERE clause etc. of a statement. While the most familiar kind of :class:`.ColumnElement` is the :class:`.Column` object, :class:`.ColumnElement` serves as the basis for any unit that may be present in a SQL expression, including the expressions themselves, SQL functions, bound parameters, literal expressions, keywords such as ``NULL``, etc. :class:`.ColumnElement` is the ultimate base class for all such elements. A wide variety of SQLAlchemy Core functions work at the SQL expression level, and are intended to accept instances of :class:`.ColumnElement` as arguments. These functions will typically document that they accept a "SQL expression" as an argument. What this means in terms of SQLAlchemy usually refers to an input which is either already in the form of a :class:`.ColumnElement` object, or a value which can be **coerced** into one. The coercion rules followed by most, but not all, SQLAlchemy Core functions with regards to SQL expressions are as follows: * a literal Python value, such as a string, integer or floating point value, boolean, datetime, ``Decimal`` object, or virtually any other Python object, will be coerced into a "literal bound value". This generally means that a :func:`.bindparam` will be produced featuring the given value embedded into the construct; the resulting :class:`.BindParameter` object is an instance of :class:`.ColumnElement`. The Python value will ultimately be sent to the DBAPI at execution time as a parameterized argument to the ``execute()`` or ``executemany()`` methods, after SQLAlchemy type-specific converters (e.g. those provided by any associated :class:`.TypeEngine` objects) are applied to the value. * any special object value, typically ORM-level constructs, which feature a method called ``__clause_element__()``. The Core expression system looks for this method when an object of otherwise unknown type is passed to a function that is looking to coerce the argument into a :class:`.ColumnElement` expression. The ``__clause_element__()`` method, if present, should return a :class:`.ColumnElement` instance. The primary use of ``__clause_element__()`` within SQLAlchemy is that of class-bound attributes on ORM-mapped classes; a ``User`` class which contains a mapped attribute named ``.name`` will have a method ``User.name.__clause_element__()`` which when invoked returns the :class:`.Column` called ``name`` associated with the mapped table. * The Python ``None`` value is typically interpreted as ``NULL``, which in SQLAlchemy Core produces an instance of :func:`.null`. A :class:`.ColumnElement` provides the ability to generate new :class:`.ColumnElement` objects using Python expressions. This means that Python operators such as ``==``, ``!=`` and ``<`` are overloaded to mimic SQL operations, and allow the instantiation of further :class:`.ColumnElement` instances which are composed from other, more fundamental :class:`.ColumnElement` objects. For example, two :class:`.ColumnClause` objects can be added together with the addition operator ``+`` to produce a :class:`.BinaryExpression`. Both :class:`.ColumnClause` and :class:`.BinaryExpression` are subclasses of :class:`.ColumnElement`:: >>> from sqlalchemy.sql import column >>> column('a') + column('b') >>> print column('a') + column('b') a + b .. seealso:: :class:`.Column` :func:`.expression.column` ucolumn_elementcCsv|tjtjtjfkrL|jjtjjkrLt|tj tj S|tj tj fkrnt |S|SdS(N(RRmRot_asboolRt_type_affinityRt BOOLEANTYPEt AsBooleantistruetisfalsetany_optall_optGrouping(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRas  cCsE|jjtjjkr.t|tjtjStt |j SdS(N( RRRRRRRRtsuperR8Rs(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsscCstjS(N(RtNULLTYPE(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCsEy|jj}Wn$tk r6td|jn X||SdS(NuOObject %r associated with '.type' attribute is not a TypeEngine class or object(Rtcomparator_factorytAttributeErrorRx(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR9s cCsZyt|j|SWn?tk rUtdt|jt|jj|fnXdS(Nu3Neither %r object nor %r object has an attribute %r(tgetattrR9RRR~(R;R,((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt __getattr__s  cOs||j||S(N(R9(R;topR\RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytoperatescKs|||j|S(N(R9(R;RR\RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytreverse_operatesc Cs(td|d|d|d|jdtS(Nt_compared_to_operatorRt_compared_to_typeR$(R%R&RR'(R;RutobjR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _bind_params cCs|S(u^Return a column expression. Part of the inspection interface; returns self. ((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|fS(N((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_select_iterablescCstjd|jDS(Ncss|]}|js|VqdS(N(t_proxies(t.0R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pys s(RR>t proxy_set(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt base_columnsscCs:tj|g}x!|jD]}|j|jqW|S(N(RR>RRZR(R;R@R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs=tj|g}x$|jD]}|j|jqW|S(uAn 'uncached' version of proxy set. This is so that we can read annotations from the list of columns without breaking the caching of the above proxy_set. (RR>RRZt_uncached_proxy_set(R;R@R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCst|jj|jS(uoReturn True if the given :class:`.ColumnElement` has a common ancestor to this :class:`.ColumnElement`.(tboolRt intersection(R;t othercolumn((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytshares_lineagescCs.t|do-t|do-|j|jkS(uhReturn True if the given column element compares to this one when targeting within a result row.uname(Rqtname(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_compare_name_for_resultscKs|dkr]|j}|jr*|j}qcyt|}Wqctjk rY|j}qcXn|}t|rxt|n|dt|ddd|}|g|_ |j dk r|j j j ||_ n||j |<|S(uCreate a new :class:`.ColumnElement` representing this :class:`.ColumnElement` as it appears in the select list of a descending selectable. Rutypet _selectableN(R&t anon_labelR,RiR tUnsupportedCompilationErrort ColumnClauset _as_truncatedRRR:tcolumnstgett_columns(R;t selectableRtname_is_truncatableRR,tco((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _make_proxys$       cKs|f}|r1||kr1||j|}nxG|D];}|rW|j|rWtSt|t|kr8tSq8WtSdS(uCompare this ColumnElement to another. Special arguments understood: :param use_proxies: when True, consider two columns that share a common base column as equivalent (i.e. shares_lineage()) :param equivalents: a dictionary of columns as keys mapped to sets of columns. If the given "other" column is present in this dictionary, if any of the columns in the corresponding set() pass the comparison test, the result is True. This is used to expand the comparison to other columns that may be known to be equivalent to this one via foreign key or other criterion. N(tunionRR'thashR+(R;R\t use_proxiest equivalentsRt to_comparetoth((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]7s  cCs t||S(u?Produce a type cast, i.e. ``CAST( AS )``. This is a shortcut to the :func:`~.expression.cast` function. .. seealso:: :ref:`coretutorial_casts` :func:`~.expression.cast` :func:`~.expression.type_coerce` .. versionadded:: 1.0.7 (tCast(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytcastSscCst|||jS(uProduce a column label, i.e. `` AS ``. This is a shortcut to the :func:`~.expression.label` function. if 'name' is None, an anonymous label name will be generated. (tLabelR(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytlabelescCsEx|jdk r|j}qWtdt|t|ddfS(uprovides a constant 'anonymous label' for this ColumnElement. This is a label() expression which will be named at compile time. The same label() is returned each time anon_label is called so that expressions can reference anon_label multiple times, producing the same label name at compile time. the compiler uses this function automatically at compile time for expressions that are known to be 'unnamed' like binary expressions and function calls. u %%(%d %s)sunameuanonN(R:R&t_anonymous_labelRR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRos (N(()R~R}RRR+t primary_keyt foreign_keysRR&t_labelR,t _key_labelR't_render_label_in_columns_clauset_resolve_labelt_allow_label_resolvet_is_implicitly_booleant _alt_namesRaRsRRRR9RRRRRRRRRRRRRR]RRR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR8sBH            R%c BseZdZdZeZfZeeeeeeeeeed Z dZ dZ e dZ dZdZdZd Zd ZRS( uRepresent a "bound expression". :class:`.BindParameter` is invoked explicitly using the :func:`.bindparam` function, as in:: from sqlalchemy import bindparam stmt = select([users_table]).\ where(users_table.c.name == bindparam('username')) Detailed discussion of how :class:`.BindParameter` is used is at :func:`.bindparam`. .. seealso:: :func:`.bindparam` u bindparamc Cst|tr$|j}|j}n|tkrK|tkoE|dk}n|tkr`d}n|dk r~t||}n|rtdt||pdf|_n|ptdt||_|j|_ |pd|_ ||_ ||_ ||_ | |_||_||_|dkra| dk rL| j| ||_qtj||_n't|tr||_n ||_dS(u<$Produce a "bound expression". The return value is an instance of :class:`.BindParameter`; this is a :class:`.ColumnElement` subclass which represents a so-called "placeholder" value in a SQL expression, the value of which is supplied at the point at which the statement in executed against a database connection. In SQLAlchemy, the :func:`.bindparam` construct has the ability to carry along the actual value that will be ultimately used at expression time. In this way, it serves not just as a "placeholder" for eventual population, but also as a means of representing so-called "unsafe" values which should not be rendered directly in a SQL statement, but rather should be passed along to the :term:`DBAPI` as values which need to be correctly escaped and potentially handled for type-safety. When using :func:`.bindparam` explicitly, the use case is typically one of traditional deferment of parameters; the :func:`.bindparam` construct accepts a name which can then be referred to at execution time:: from sqlalchemy import bindparam stmt = select([users_table]).\ where(users_table.c.name == bindparam('username')) The above statement, when rendered, will produce SQL similar to:: SELECT id, name FROM user WHERE name = :username In order to populate the value of ``:username`` above, the value would typically be applied at execution time to a method like :meth:`.Connection.execute`:: result = connection.execute(stmt, username='wendy') Explicit use of :func:`.bindparam` is also common when producing UPDATE or DELETE statements that are to be invoked multiple times, where the WHERE criterion of the statement is to change on each invocation, such as:: stmt = (users_table.update(). where(user_table.c.name == bindparam('username')). values(fullname=bindparam('fullname')) ) connection.execute( stmt, [{"username": "wendy", "fullname": "Wendy Smith"}, {"username": "jack", "fullname": "Jack Jones"}, ] ) SQLAlchemy's Core expression system makes wide use of :func:`.bindparam` in an implicit sense. It is typical that Python literal values passed to virtually all SQL expression functions are coerced into fixed :func:`.bindparam` constructs. For example, given a comparison operation such as:: expr = users_table.c.name == 'Wendy' The above expression will produce a :class:`.BinaryExpression` construct, where the left side is the :class:`.Column` object representing the ``name`` column, and the right side is a :class:`.BindParameter` representing the literal value:: print(repr(expr.right)) BindParameter('%(4327771088 name)s', 'Wendy', type_=String()) The expression above will render SQL such as:: user.name = :name_1 Where the ``:name_1`` parameter name is an anonymous name. The actual string ``Wendy`` is not in the rendered string, but is carried along where it is later used within statement execution. If we invoke a statement like the following:: stmt = select([users_table]).where(users_table.c.name == 'Wendy') result = connection.execute(stmt) We would see SQL logging output as:: SELECT "user".id, "user".name FROM "user" WHERE "user".name = %(name_1)s {'name_1': 'Wendy'} Above, we see that ``Wendy`` is passed as a parameter to the database, while the placeholder ``:name_1`` is rendered in the appropriate form for the target database, in this case the PostgreSQL database. Similarly, :func:`.bindparam` is invoked automatically when working with :term:`CRUD` statements as far as the "VALUES" portion is concerned. The :func:`.insert` construct produces an ``INSERT`` expression which will, at statement execution time, generate bound placeholders based on the arguments passed, as in:: stmt = users_table.insert() result = connection.execute(stmt, name='Wendy') The above will produce SQL output as:: INSERT INTO "user" (name) VALUES (%(name)s) {'name': 'Wendy'} The :class:`.Insert` construct, at compilation/execution time, rendered a single :func:`.bindparam` mirroring the column name ``name`` as a result of the single ``name`` parameter we passed to the :meth:`.Connection.execute` method. :param key: the key (e.g. the name) for this bind param. Will be used in the generated SQL statement for dialects that use named parameters. This value may be modified when part of a compilation operation, if other :class:`BindParameter` objects exist with the same key, or if its length is too long and truncation is required. :param value: Initial value for this bind param. Will be used at statement execution time as the value for this parameter passed to the DBAPI, if no other value is indicated to the statement execution method for this particular parameter name. Defaults to ``None``. :param callable\_: A callable function that takes the place of "value". The function will be called at statement execution time to determine the ultimate value. Used for scenarios where the actual bind value cannot be determined at the point at which the clause construct is created, but embedded bind values are still desirable. :param type\_: A :class:`.TypeEngine` class or instance representing an optional datatype for this :func:`.bindparam`. If not passed, a type may be determined automatically for the bind, based on the given value; for example, trivial Python types such as ``str``, ``int``, ``bool`` may result in the :class:`.String`, :class:`.Integer` or :class:`.Boolean` types being automatically selected. The type of a :func:`.bindparam` is significant especially in that the type will apply pre-processing to the value before it is passed to the database. For example, a :func:`.bindparam` which refers to a datetime value, and is specified as holding the :class:`.DateTime` type, may apply conversion needed to the value (such as stringification on SQLite) before passing the value to the database. :param unique: if True, the key name of this :class:`.BindParameter` will be modified if another :class:`.BindParameter` of the same name already has been located within the containing expression. This flag is used generally by the internals when producing so-called "anonymous" bound expressions, it isn't generally applicable to explicitly-named :func:`.bindparam` constructs. :param required: If ``True``, a value is required at execution time. If not passed, it defaults to ``True`` if neither :paramref:`.bindparam.value` or :paramref:`.bindparam.callable` were passed. If either of these parameters are present, then :paramref:`.bindparam.required` defaults to ``False``. :param quote: True if this parameter name requires quoting and is not currently known as a SQLAlchemy reserved word; this currently only applies to the Oracle backend, where bound names must sometimes be quoted. :param isoutparam: if True, the parameter should be treated like a stored procedure "OUT" parameter. This applies to backends such as Oracle which support OUT parameters. :param expanding: if True, this parameter will be treated as an "expanding" parameter at execution time; the parameter value is expected to be a sequence, rather than a scalar value, and the string SQL statement will be transformed on a per-execution basis to accommodate the sequence with a variable number of parameter slots passed to the DBAPI. This is to allow statement caching to be used in conjunction with an IN clause. .. seealso:: :meth:`.ColumnOperators.in_` :ref:`baked_in` - with baked queries .. note:: The "expanding" feature does not support "executemany"- style parameter sets. .. versionadded:: 1.2 .. versionchanged:: 1.3 the "expanding" bound parameter feature now supports empty lists. .. seealso:: :ref:`coretutorial_bind_param` :ref:`coretutorial_insert_expressions` :func:`.outparam` u %%(%d %s)suparamu %%(%d param)sN(t isinstanceRRR,RR&t quoted_nameRRt_identifying_keyt _orig_keyR$R(tcallableR*RUt expandingtcoerce_compared_valueRt_resolve_value_to_type( R;R,R(RR$RUtquotet callable_RR*RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__init__s:      %         cCs|j}||_|S(urReturn a copy of this :class:`.BindParameter` in the context of an expanding IN against a tuple. (Rt_expanding_in_types(R;ttypestcloned((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_with_expanding_in_typess  cCsR|j}||_d|_t|_|jtjkrNtj ||_n|S(uXReturn a copy of this :class:`.BindParameter` with the given value set. N( RR(R&RR+RURRRR(R;R(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _with_values    cCs|jr|jS|jSdS(uReturn the value of this bound parameter, taking into account if the ``callable`` parameter was set. The ``callable`` value will be evaluated and returned if present, else ``value``. N(RR((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyteffective_values  cCsGtj|}|jrCtdt||jp3df|_n|S(Nu %%(%d %s)suparam(R1RR$RRRR,(R;R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs  (cCsA|js=t|_tdt||jp-df|_ndS(Nu %%(%d %s)suparam(R$R'RRRR,(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRVs  cKsFt|toE|jj|joE|j|jkoE|j|jkS(u@Compare this :class:`BindParameter` to the given clause.(RR%Rt_compare_type_affinityR(R(R;R\R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]scCsH|jj}|j}|jr:|j}d|d`` to specify bind parameters; they will be compiled to their engine-specific format. :param autocommit: whether or not to set the "autocommit" execution option for this :class:`.TextClause` object. :param bind: an optional connection or engine to be used for this text query. :param bindparams: A list of :func:`.bindparam` instances used to provide information about parameters embedded in the statement. E.g.:: stmt = text("SELECT * FROM table WHERE id=:id", bindparams=[bindparam('id', value=5, type_=Integer)]) :param typemap: A dictionary mapping the names of columns represented in the columns clause of a ``SELECT`` statement to type objects. E.g.:: stmt = text("SELECT * FROM table", typemap={'id': Integer, 'name': String}, ) .. seealso:: :ref:`sqlexpression_text` - in the Core tutorial :ref:`orm_tutorial_literal_sql` - in the ORM tutorial RWRN(RRRR&texecution_options(R;RRWRRRtstmt((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _create_textHs cOs|jj|_}xV|D]N}y||j}Wn'tk r]tjd|jqX|||j 5) Above, we pass a series of :func:`.column` elements to the :meth:`.TextClause.columns` method positionally. These :func:`.column` elements now become first class elements upon the :attr:`.TextAsFrom.c` column collection, just like any other selectable. The column expressions we pass to :meth:`.TextClause.columns` may also be typed; when we do so, these :class:`.TypeEngine` objects become the effective return type of the column, so that SQLAlchemy's result-set-processing systems may be used on the return values. This is often needed for types such as date or boolean types, as well as for unicode processing on some dialect configurations:: stmt = text("SELECT id, name, timestamp FROM some_table") stmt = stmt.columns( column('id', Integer), column('name', Unicode), column('timestamp', DateTime) ) for id, name, timestamp in connection.execute(stmt): print(id, name, timestamp) As a shortcut to the above syntax, keyword arguments referring to types alone may be used, if only type conversion is needed:: stmt = text("SELECT id, name, timestamp FROM some_table") stmt = stmt.columns( id=Integer, name=Unicode, timestamp=DateTime ) for id, name, timestamp in connection.execute(stmt): print(id, name, timestamp) The positional form of :meth:`.TextClause.columns` also provides the unique feature of **positional column targeting**, which is particularly useful when using the ORM with complex textual queries. If we specify the columns from our model to :meth:`.TextClause.columns`, the result set will match to those columns positionally, meaning the name or origin of the column in the textual SQL doesn't matter:: stmt = text("SELECT users.id, addresses.id, users.id, " "users.name, addresses.email_address AS email " "FROM users JOIN addresses ON users.id=addresses.user_id " "WHERE users.id = 1").columns( User.id, Address.id, Address.user_id, User.name, Address.email_address ) query = session.query(User).from_statement(stmt).options( contains_eager(User.addresses)) .. versionadded:: 1.1 the :meth:`.TextClause.columns` method now offers positional column targeting in the result set when the column expressions are passed purely positionally. The :meth:`.TextClause.columns` method provides a direct route to calling :meth:`.FromClause.alias` as well as :meth:`.SelectBase.cte` against a textual SELECT statement:: stmt = stmt.columns(id=Integer, name=String).cte('st') stmt = select([sometable]).where(sometable.c.id == stmt.c.id) .. versionadded:: 0.9.0 :func:`.text` can now be converted into a fully featured "selectable" construct using the :meth:`.TextClause.columns` method. t positional(R,RRBRt TextAsFromR( R;RtcolsRtcoltpositional_input_colsR,Rtkeyed_input_cols((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR1s_C. cCstjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|jj|S(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR9scCs!|tjkrt|S|SdS(N(Rtin_opR(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRas c s/tfd|jjD|_dS(Nc3s'|]}|j|fVqdS(N(R,(Rtb(RHR(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pys s(tdictRRE(R;RHR((RHRsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^scKst|jjS(N(tlistRRE(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_scCst|to|j|jkS(N(RRR(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]sN(u0.6uThe :paramref:`.text.autocommit` parameter is deprecated and will be removed in a future release. Please use the :paramref:`.Connection.execution_options.autocommit` parameter in conjunction with the :meth:`.Executable.execution_options` method.(u0.9uThe :paramref:`.text.bindparams` parameter is deprecated and will be removed in a future release. Please refer to the :meth:`.TextClause.bindparams` method.(u0.9uThe :paramref:`.text.typemap` parameter is deprecated and will be removed in a future release. Please refer to the :meth:`.TextClause.columns` method.()R~R}RRtreRftUNICODERRt_execution_optionsRRR+RRnRRRt _hide_fromsR&R,RRRRt classmethodRtdeprecated_paramsRRRRRRRR9RaRR^R_R](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s>    wYn   tNullcBs>eZdZdZejdZedZdZ RS(uRepresent the NULL keyword in a SQL statement. :class:`.Null` is accessed as a constant via the :func:`.null` function. unullcCstjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCstS(u+Return a constant :class:`.Null` construct.(R (tcls((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _instancescCs t|tS(N(RR (R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]s( R~R}RRRRRRR R](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s tFalse_cBsGeZdZdZejdZdZedZ dZ RS(uRepresent the ``false`` keyword, or equivalent, in a SQL statement. :class:`.False_` is accessed as a constant via the :func:`.false` function. ufalsecCstjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCstS(N(tTrue_(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsscCstS(uReturn a :class:`.False_` construct. E.g.:: >>> from sqlalchemy import false >>> print select([t.c.x]).where(false()) SELECT x FROM t WHERE false A backend which does not support true/false constants will render as an expression against 1 or 0:: >>> print select([t.c.x]).where(false()) SELECT x FROM t WHERE 0 = 1 The :func:`.true` and :func:`.false` constants also feature "short circuit" operation within an :func:`.and_` or :func:`.or_` conjunction:: >>> print select([t.c.x]).where(or_(t.c.x > 5, true())) SELECT x FROM t WHERE true >>> print select([t.c.x]).where(and_(t.c.x > 5, false())) SELECT x FROM t WHERE false .. versionchanged:: 0.9 :func:`.true` and :func:`.false` feature better integrated behavior within conjunctions and on dialects that don't support true/false constants. .. seealso:: :func:`.true` (R (R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s$cCs t|tS(N(RR (R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]s( R~R}RRRRRRsRR R](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s  &RcBsVeZdZdZejdZdZedZ edZ dZ RS(uRepresent the ``true`` keyword, or equivalent, in a SQL statement. :class:`.True_` is accessed as a constant via the :func:`.true` function. utruecCstjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCstS(N(R (R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsscCs|dkr|jS|SdS(N(R&R (R R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_ifnones  cCstS(uReturn a constant :class:`.True_` construct. E.g.:: >>> from sqlalchemy import true >>> print select([t.c.x]).where(true()) SELECT x FROM t WHERE true A backend which does not support true/false constants will render as an expression against 1 or 0:: >>> print select([t.c.x]).where(true()) SELECT x FROM t WHERE 1 = 1 The :func:`.true` and :func:`.false` constants also feature "short circuit" operation within an :func:`.and_` or :func:`.or_` conjunction:: >>> print select([t.c.x]).where(or_(t.c.x > 5, true())) SELECT x FROM t WHERE true >>> print select([t.c.x]).where(and_(t.c.x > 5, false())) SELECT x FROM t WHERE false .. versionchanged:: 0.9 :func:`.true` and :func:`.false` feature better integrated behavior within conjunctions and on dialects that don't support true/false constants. .. seealso:: :func:`.false` (R(R ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR $s$cCs t|tS(N(RR(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]Js( R~R}RRRRRRsRRR R](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s &t ClauseListcBseZdZdZdZdZdZedZdZ e dZ dZ ed Z d d Zd ZRS( uzDescribe a list of clauses, separated by an operator. By default, is comma-separated, such as a column listing. u clauselistcOs|jdtj|_|jdt|_|jdt|_|jdt|_|jdt }|jrg|D]!}||j d|j^qy|_ n"g|D]}||^q|_ tj |j|_ dS(Nuoperatorugroupugroup_contentsu _tuple_valuesu_literal_as_textR`(RBRtcomma_opRuR'Rtgroup_contentsR+t _tuple_valuest_expression_literal_as_textRatclausest is_booleanR(R;RRSttext_converterR/((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRWs  1"cCs t|jS(N(titerR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__iter__hscCs t|jS(N(RYR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__len__kscCs t|S(N(R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRnscCsK|jr1|jjt|jd|jn|jjt|dS(NR`(RRtappendt_literal_as_textRaRu(R;R/((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRrs  cKs,g|jD]}|||^q |_dS(N(R(R;RHRR/((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^zscKs|jS(N(R(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_}scCs,ttjg|jD]}|j^qS(N(Rt itertoolstchainRR(R;R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs0|jr(tj|j|r(t|S|SdS(N(RRt is_precedentRuR(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRas cKsht|t r<t|jdkr<|jdj||St|tr`t|jt|jkr`|j|jkr`|jtjtjfkrt }xW|jD]L}xCt |jj |D])}|j||r|j |PqqWqWt|t|jkSxOt dt|jD]*}|j|j|j||s+t Sq+WtSnt SdS(uCompare this :class:`.ClauseList` to the given :class:`.ClauseList`, including a comparison of all the clause items. iiN(RRRYRR]RuRRmRotsett differenceR?trangeR+R'(R;R\Rt completedR/t other_clauseti((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]s&%     N(R~R}RRRRRRRRRR^R_RR&RaR](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRNs       tBooleanClauseListcBsneZdZeZdZedZedZedZ e dZ ddZ dZRS( u clauselistcOstddS(Nu+BooleanClauseList has a private constructor(tNotImplementedError(R;targR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsc OsAg}gtj|D]}t|^q}xR|D]J}t||rPq5n"t||rr|jdtjS|j|q5Wt|dkr|djdtjS| r|r|djdtjSg|D]}|jd|^q}|j |} || _ t | _ || _ t | _tj| _t | _| S(NR`ii(Rtcoerce_generator_argRRRaRRRRYR3RR'RRuRRRRR( R Rut continue_ontskip_onRRtconvert_clausesR/R<R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _constructs,%  %      cGs|jtjtt|S(uProduce a conjunction of expressions joined by ``AND``. E.g.:: from sqlalchemy import and_ stmt = select([users_table]).where( and_( users_table.c.name == 'wendy', users_table.c.enrolled == True ) ) The :func:`.and_` conjunction is also available using the Python ``&`` operator (though note that compound expressions need to be parenthesized in order to function with Python operator precedence behavior):: stmt = select([users_table]).where( (users_table.c.name == 'wendy') & (users_table.c.enrolled == True) ) The :func:`.and_` operation is also implicit in some cases; the :meth:`.Select.where` method for example can be invoked multiple times against a statement, which will have the effect of each clause being combined using :func:`.and_`:: stmt = select([users_table]). where(users_table.c.name == 'wendy'). where(users_table.c.enrolled == True) .. seealso:: :func:`.or_` (R-RRmRR (R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRms'cGs|jtjtt|S(udProduce a conjunction of expressions joined by ``OR``. E.g.:: from sqlalchemy import or_ stmt = select([users_table]).where( or_( users_table.c.name == 'wendy', users_table.c.name == 'jack' ) ) The :func:`.or_` conjunction is also available using the Python ``|`` operator (though note that compound expressions need to be parenthesized in order to function with Python operator precedence behavior):: stmt = select([users_table]).where( (users_table.c.name == 'wendy') | (users_table.c.name == 'jack') ) .. seealso:: :func:`.and_` (R-RRoR R(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRoscCs|fS(N((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR!scCs*|js |Stt|jd|SdS(NR`(RRR&Ra(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa%s cCs tj|S(N(RRs(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs+sN(R~R}RR+RRRR-RmRoRRR&RaRs(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR&s #)  tTuplecBs2eZdZdZedZddZRS(uRepresent a SQL tuple.cOsg|D]}t|^q}g|D]}|j^q&|_|jd|jr]|jdntj|_tt|j||dS(uReturn a :class:`.Tuple`. Main usage is to produce a composite IN construct:: from sqlalchemy import tuple_ tuple_(table.c.col1, table.c.col2).in_( [(1, 2), (5, 12), (10, 19)] ) .. versionchanged:: 1.3.6 Added support for SQLite IN tuples. .. warning:: The composite IN construct is not supported by all backends, and is currently known to work on PostgreSQL, MySQL, and SQLite. Unsupported backends will raise a subclass of :class:`~sqlalchemy.exc.DBAPIError` when such an expression is invoked. utype_iN( RRt _type_tupleRBRRRR.R(R;RRR<R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR6s %cCs|fS(N((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRVscCsVtgt||jD]3\}}td|d|d|dtd|^qjS(NRRR$R(R.tzipR/R%R&R'Ra(R;RuRRtotcompared_to_type((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRZsN(R~R}RRRRR&R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR.3s tCasecBsGeZdZdZdddZedZdZe dZ RS(uRepresent a ``CASE`` expression. :class:`.Case` is produced using the :func:`.case` factory function, as in:: from sqlalchemy import case stmt = select([users_table]). where( case( [ (users_table.c.name == 'wendy', 'W'), (users_table.c.name == 'jack', 'J') ], else_='E' ) ) Details on :class:`.Case` usage is at :func:`.case`. .. seealso:: :func:`.case` ucasecCs.ytj|}Wntk r&nX|dk rmg|D]*\}}t|jt|f^q:}n7g|D]*\}}t|jt|f^qt}|rt|ddj}nd}|dkrd|_ nt||_ ||_||_ |dk r!t||_ n d|_ dS(uProduce a ``CASE`` expression. The ``CASE`` construct in SQL is a conditional object that acts somewhat analogously to an "if/then" construct in other languages. It returns an instance of :class:`.Case`. :func:`.case` in its usual form is passed a list of "when" constructs, that is, a list of conditions and results as tuples:: from sqlalchemy import case stmt = select([users_table]).\ where( case( [ (users_table.c.name == 'wendy', 'W'), (users_table.c.name == 'jack', 'J') ], else_='E' ) ) The above statement will produce SQL resembling:: SELECT id, name FROM user WHERE CASE WHEN (name = :name_1) THEN :param_1 WHEN (name = :name_2) THEN :param_2 ELSE :param_3 END When simple equality expressions of several values against a single parent column are needed, :func:`.case` also has a "shorthand" format used via the :paramref:`.case.value` parameter, which is passed a column expression to be compared. In this form, the :paramref:`.case.whens` parameter is passed as a dictionary containing expressions to be compared against keyed to result expressions. The statement below is equivalent to the preceding statement:: stmt = select([users_table]).\ where( case( {"wendy": "W", "jack": "J"}, value=users_table.c.name, else_='E' ) ) The values which are accepted as result values in :paramref:`.case.whens` as well as with :paramref:`.case.else_` are coerced from Python literals into :func:`.bindparam` constructs. SQL expressions, e.g. :class:`.ColumnElement` constructs, are accepted as well. To coerce a literal string expression into a constant expression rendered inline, use the :func:`.literal_column` construct, as in:: from sqlalchemy import case, literal_column case( [ ( orderline.c.qty > 100, literal_column("'greaterthan100'") ), ( orderline.c.qty > 10, literal_column("'greaterthan10'") ) ], else_=literal_column("'lessthan10'") ) The above will render the given constants without using bound parameters for the result values (but still for the comparison values), as in:: CASE WHEN (orderline.qty > :qty_1) THEN 'greaterthan100' WHEN (orderline.qty > :qty_2) THEN 'greaterthan10' ELSE 'lessthan10' END :param whens: The criteria to be compared against, :paramref:`.case.whens` accepts two different forms, based on whether or not :paramref:`.case.value` is used. In the first form, it accepts a list of 2-tuples; each 2-tuple consists of ``(, )``, where the SQL expression is a boolean expression and "value" is a resulting value, e.g.:: case([ (users_table.c.name == 'wendy', 'W'), (users_table.c.name == 'jack', 'J') ]) In the second form, it accepts a Python dictionary of comparison values mapped to a resulting value; this form requires :paramref:`.case.value` to be present, and values will be compared using the ``==`` operator, e.g.:: case( {"wendy": "W", "jack": "J"}, value=users_table.c.name ) :param value: An optional SQL expression which will be used as a fixed "comparison point" for candidate values within a dictionary passed to :paramref:`.case.whens`. :param else\_: An optional SQL expression which will be the evaluated result of the ``CASE`` construct if all expressions within :paramref:`.case.whens` evaluate to false. When omitted, most databases will produce a result of NULL if none of the "when" expressions evaluate to true. iN( Rtdictlike_iteritemsRxR&RRat _no_literalsRRR(twhenstelse_(R;R6R(R7R<trtwhenlistR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs(y  74     cKs|jdk r'||j||_ng|jD]*\}}||||||f^q1|_|jdk r||j||_ndS(N(R(R&R6R7(R;RHRtxty((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^! s =cks\|jdk r|jVnx!|jD]\}}|V|Vq$W|jdk rX|jVndS(N(R(R&R6R7(R;RSR:R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_( s  cCs/ttjg|jD]}|j^qS(N(RRRR_R(R;R:((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR1 sN( R~R}RRR&RRR^R_RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR3js   cCst|d|dtS(u3Produce a :class:`.ColumnClause` object that has the :paramref:`.column.is_literal` flag set to True. :func:`.literal_column` is similar to :func:`.column`, except that it is more often used as a "standalone" column expression that renders exactly as stated; while :func:`.column` stores a string name that will be assumed to be part of a table and may be quoted as such, :func:`.literal_column` can be that, or any other arbitrary column-oriented expression. :param text: the text of the expression; can be any SQL expression. Quoting rules will not be applied. To specify a column-name expression which should be subject to quoting rules, use the :func:`column` function. :param type\_: an optional :class:`~sqlalchemy.types.TypeEngine` object which will provide result-set translation and additional expression semantics for this column. If left as None the type will be NullType. .. seealso:: :func:`.column` :func:`.text` :ref:`sqlexpression_literal_column` Rt is_literal(RR'(RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytliteral_column8 sRcBsAeZdZdZdZedZdZedZ RS(u`Represent a ``CAST`` expression. :class:`.Cast` is produced using the :func:`.cast` factory function, as in:: from sqlalchemy import cast, Numeric stmt = select([ cast(product_table.c.unit_price, Numeric(10, 4)) ]) Details on :class:`.Cast` usage is at :func:`.cast`. .. seealso:: :ref:`coretutorial_casts` :func:`.cast` :func:`.type_coerce` - an alternative to CAST that coerces the type on the Python side only, which is often sufficient to generate the correct SQL and data coercion. ucastcCs@tj||_t|d|j|_t|j|_dS(uProduce a ``CAST`` expression. :func:`.cast` returns an instance of :class:`.Cast`. E.g.:: from sqlalchemy import cast, Numeric stmt = select([ cast(product_table.c.unit_price, Numeric(10, 4)) ]) The above statement will produce SQL resembling:: SELECT CAST(unit_price AS NUMERIC(10, 4)) FROM product The :func:`.cast` function performs two distinct functions when used. The first is that it renders the ``CAST`` expression within the resulting SQL string. The second is that it associates the given type (e.g. :class:`.TypeEngine` class or instance) with the column expression on the Python side, which means the expression will take on the expression operator behavior associated with that type, as well as the bound-value handling and result-row-handling behavior of the type. .. versionchanged:: 0.9.0 :func:`.cast` now applies the given type to the expression such that it takes effect on the bound-value, e.g. the Python-to-database direction, in addition to the result handling, e.g. database-to-Python, direction. An alternative to :func:`.cast` is the :func:`.type_coerce` function. This function performs the second task of associating an expression with a specific type, but does not render the ``CAST`` expression in SQL. :param expression: A SQL expression, such as a :class:`.ColumnElement` expression or a Python string which will be coerced into a bound literal value. :param type\_: A :class:`.TypeEngine` class or instance indicating the type to which the ``CAST`` should apply. .. seealso:: :ref:`coretutorial_casts` :func:`.type_coerce` - an alternative to CAST that coerces the type on the Python side only, which is often sufficient to generate the correct SQL and data coercion. RN(Rt to_instanceRRR/Rt typeclause(R;RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRu s5cKs.||j||_||j||_dS(N(R/R?(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^ scKs|j|jfS(N(R/R?(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_ scCs |jjS(N(R/R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s( R~R}RRRRR^R_RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRY s  9  t TypeCoercecBsSeZdZdZdZedZdZedZ e j dZ RS(uRepresent a Python-side type-coercion wrapper. :class:`.TypeCoerce` supplies the :func:`.expression.type_coerce` function; see that function for usage details. .. versionchanged:: 1.1 The :func:`.type_coerce` function now produces a persistent :class:`.TypeCoerce` wrapper object rather than translating the given object in place. .. seealso:: :func:`.expression.type_coerce` :func:`.cast` u type_coercecCs.tj||_t|d|j|_dS(uL Associate a SQL expression with a particular type, without rendering ``CAST``. E.g.:: from sqlalchemy import type_coerce stmt = select([ type_coerce(log_table.date_string, StringDateTime()) ]) The above construct will produce a :class:`.TypeCoerce` object, which renders SQL that labels the expression, but otherwise does not modify its value on the SQL side:: SELECT date_string AS anon_1 FROM log When result rows are fetched, the ``StringDateTime`` type will be applied to result rows on behalf of the ``date_string`` column. The rationale for the "anon_1" label is so that the type-coerced column remains separate in the list of result columns vs. other type-coerced or direct values of the target column. In order to provide a named label for the expression, use :meth:`.ColumnElement.label`:: stmt = select([ type_coerce( log_table.date_string, StringDateTime()).label('date') ]) A type that features bound-value handling will also have that behavior take effect when literal values or :func:`.bindparam` constructs are passed to :func:`.type_coerce` as targets. For example, if a type implements the :meth:`.TypeEngine.bind_expression` method or :meth:`.TypeEngine.bind_processor` method or equivalent, these functions will take effect at statement compilation/execution time when a literal value is passed, as in:: # bound-value handling of MyStringType will be applied to the # literal value "some string" stmt = select([type_coerce("some string", MyStringType)]) :func:`.type_coerce` is similar to the :func:`.cast` function, except that it does not render the ``CAST`` expression in the resulting statement. :param expression: A SQL expression, such as a :class:`.ColumnElement` expression or a Python string which will be coerced into a bound literal value. :param type\_: A :class:`.TypeEngine` class or instance indicating the type to which the expression is coerced. .. seealso:: :ref:`coretutorial_casts` :func:`.cast` RN(RR>RRR/(R;RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s?cKs,||j||_|jjdddS(Nutyped_expression(R/R4RBR&(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^ scKs |jfS(N(R/(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_ scCs |jjS(N(R/R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCs<t|jtr1|jj}|j|_|S|jSdS(N(RR/R%RR(R;tbp((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyttyped_expression s  ( R~R}RRRRR^R_RRRRRB(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR@ s B  tExtractcBsAeZdZdZdZedZdZedZ RS(u=Represent a SQL EXTRACT clause, ``extract(field FROM expr)``.uextractcKs+tj|_||_t|d|_dS(uReturn a :class:`.Extract` construct. This is typically available as :func:`.extract` as well as ``func.extract`` from the :data:`.func` namespace. N(Rt INTEGERTYPERtfieldRR&R(R;RERRS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR* s  cKs||j||_dS(N(R(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^6 scKs |jfS(N(R(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_9 scCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR< s( R~R}RRRRR^R_RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRC% s   t_label_referencecBs8eZdZdZdZedZedZRS(uWrap a column expression as it appears in a 'reference' context. This expression is any that includes an _order_by_label_element, which is a Label, or a DESC / ASC construct wrapping a Label. The production of _label_reference() should occur when an expression is added to this context; this includes the ORDER BY or GROUP BY of a SELECT statement, as well as a few other places, such as the ORDER BY within an OVER clause. ulabel_referencecCs ||_dS(N(R(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRP scKs||j||_dS(N(R(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^S scCsdS(N(((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRV s( R~R}RRRRR^RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRFA s    t_textual_label_referencecBs)eZdZdZejdZRS(utextual_label_referencecCs ||_dS(N(R(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^ scCstj|jS(N(RRR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _text_clausea s(R~R}RRRRRH(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRG[ s RwcBseZdZdZddddedZedZedZ edZ edZ edZ e dZe d Zed Zd Zd Zd ZddZRS(uDefine a 'unary' expression. A unary expression has a single column expression and an operator. The operator can be placed on the left (where it is called the 'operator') or right (where it is called the 'modifier') of the column expression. :class:`.UnaryExpression` is the basis for several unary operators including those used by :func:`.desc`, :func:`.asc`, :func:`.distinct`, :func:`.nullsfirst` and :func:`.nullslast`. uunarycCs[||_||_|jd|jp*|j|_tj||_||_||_dS(NR`( RutmodifierRaRRR>RRvtwraps_column_expression(R;RRuRIRRvRJ((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRv s    cCstt|dtjdtS(uZProduce the ``NULLS FIRST`` modifier for an ``ORDER BY`` expression. :func:`.nullsfirst` is intended to modify the expression produced by :func:`.asc` or :func:`.desc`, and indicates how NULL values should be handled when they are encountered during ordering:: from sqlalchemy import desc, nullsfirst stmt = select([users_table]). order_by(nullsfirst(desc(users_table.c.name))) The SQL expression from the above would resemble:: SELECT id, name FROM user ORDER BY name DESC NULLS FIRST Like :func:`.asc` and :func:`.desc`, :func:`.nullsfirst` is typically invoked from the column expression itself using :meth:`.ColumnElement.nullsfirst`, rather than as its standalone function version, as in:: stmt = (select([users_table]). order_by(users_table.c.name.desc().nullsfirst()) ) .. seealso:: :func:`.asc` :func:`.desc` :func:`.nullslast` :meth:`.Select.order_by` RIRJ(Rwt_literal_as_label_referenceRt nullsfirst_opR+(R tcolumn((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_create_nullsfirst s&  cCstt|dtjdtS(u?Produce the ``NULLS LAST`` modifier for an ``ORDER BY`` expression. :func:`.nullslast` is intended to modify the expression produced by :func:`.asc` or :func:`.desc`, and indicates how NULL values should be handled when they are encountered during ordering:: from sqlalchemy import desc, nullslast stmt = select([users_table]). order_by(nullslast(desc(users_table.c.name))) The SQL expression from the above would resemble:: SELECT id, name FROM user ORDER BY name DESC NULLS LAST Like :func:`.asc` and :func:`.desc`, :func:`.nullslast` is typically invoked from the column expression itself using :meth:`.ColumnElement.nullslast`, rather than as its standalone function version, as in:: stmt = select([users_table]). order_by(users_table.c.name.desc().nullslast()) .. seealso:: :func:`.asc` :func:`.desc` :func:`.nullsfirst` :meth:`.Select.order_by` RIRJ(RwRKRt nullslast_opR+(R RM((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_create_nullslast s%  cCstt|dtjdtS(u(Produce a descending ``ORDER BY`` clause element. e.g.:: from sqlalchemy import desc stmt = select([users_table]).order_by(desc(users_table.c.name)) will produce SQL as:: SELECT id, name FROM user ORDER BY name DESC The :func:`.desc` function is a standalone version of the :meth:`.ColumnElement.desc` method available on all SQL expressions, e.g.:: stmt = select([users_table]).order_by(users_table.c.name.desc()) :param column: A :class:`.ColumnElement` (e.g. scalar SQL expression) with which to apply the :func:`.desc` operation. .. seealso:: :func:`.asc` :func:`.nullsfirst` :func:`.nullslast` :meth:`.Select.order_by` RIRJ(RwRKRtdesc_opR+(R RM((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _create_desc s#  cCstt|dtjdtS(u!Produce an ascending ``ORDER BY`` clause element. e.g.:: from sqlalchemy import asc stmt = select([users_table]).order_by(asc(users_table.c.name)) will produce SQL as:: SELECT id, name FROM user ORDER BY name ASC The :func:`.asc` function is a standalone version of the :meth:`.ColumnElement.asc` method available on all SQL expressions, e.g.:: stmt = select([users_table]).order_by(users_table.c.name.asc()) :param column: A :class:`.ColumnElement` (e.g. scalar SQL expression) with which to apply the :func:`.asc` operation. .. seealso:: :func:`.desc` :func:`.nullsfirst` :func:`.nullslast` :meth:`.Select.order_by` RIRJ(RwRKRtasc_opR+(R RM((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _create_asc s"  cCs.t|}t|dtjd|jdtS(usProduce an column-expression-level unary ``DISTINCT`` clause. This applies the ``DISTINCT`` keyword to an individual column expression, and is typically contained within an aggregate function, as in:: from sqlalchemy import distinct, func stmt = select([func.count(distinct(users_table.c.name))]) The above would produce an expression resembling:: SELECT COUNT(DISTINCT name) FROM user The :func:`.distinct` function is also available as a column-level method, e.g. :meth:`.ColumnElement.distinct`, as in:: stmt = select([func.count(users_table.c.name.distinct())]) The :func:`.distinct` operator is different from the :meth:`.Select.distinct` method of :class:`.Select`, which produces a ``SELECT`` statement with ``DISTINCT`` applied to the result set as a whole, e.g. a ``SELECT DISTINCT`` expression. See that method for further information. .. seealso:: :meth:`.ColumnElement.distinct` :meth:`.Select.distinct` :data:`.func` RuRRJ(RRwRt distinct_opRR+(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_create_distinct0 s $   cCs-|jtjtjfkr%|jjSdSdS(N(RIRRQRSRRR&(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR\ s cCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRc scKs||j||_dS(N(R(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^g scKs |jfS(N(R(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_j scKsIt|toH|j|jkoH|j|jkoH|jj|j|S(uXCompare this :class:`UnaryExpression` against the given :class:`.ClauseElement`.(RRwRuRIRR](R;R\R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]m sc Cs|jdk rIt|jd|jd|jd|jd|jd|jS|jjt j jkrt|j dt j dt j dt j d|jddStj|SdS(NRuRvRIRRJR`(RvR&RwRRuRIRRJRRRRaRR.R1Rs(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsx s          cCs0|jr(tj|j|r(t|S|SdS(N(RuRRR(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa s N(R~R}RRR&R+RRRNRPRRRTRVRRRRR^R_R]RsRa(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRwf s&  ,+)(,   tCollectionAggregatecBs>eZdZedZedZdZdZRS(u Forms the basis for right-hand collection operator modifiers ANY and ALL. The ANY and ALL keywords are available in different ways on different backends. On PostgreSQL, they only work for an ARRAY type. On MySQL, they only work for subqueries. cCsat|}|jr3t|dr3|j}n|j}t|dtjdtj dt S(uProduce an ANY expression. This may apply to an array type for some dialects (e.g. postgresql), or to a subquery for others (e.g. mysql). e.g.:: # postgresql '5 = ANY (somearray)' expr = 5 == any_(mytable.c.somearray) # mysql '5 = ANY (SELECT value FROM table)' expr = 5 == any_(select([table.c.value])) .. versionadded:: 1.1 .. seealso:: :func:`.expression.all_` u as_scalarRuRRJ( RRRqt as_scalarRaRWRRRRR+(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _create_any s    cCsat|}|jr3t|dr3|j}n|j}t|dtjdtj dt S(uProduce an ALL expression. This may apply to an array type for some dialects (e.g. postgresql), or to a subquery for others (e.g. mysql). e.g.:: # postgresql '5 = ALL (somearray)' expr = 5 == all_(mytable.c.somearray) # mysql '5 = ALL (SELECT value FROM table)' expr = 5 == all_(select([table.c.value])) .. versionadded:: 1.1 .. seealso:: :func:`.expression.any_` u as_scalarRuRRJ( RRRqRXRaRWRRRRR+(R R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _create_all s    cOsJtj|s!tjdnt|d<|jjtj|||S(Nu2Only comparison operators may be used with ANY/ALLureverse(Rt is_comparisonR R[R'R9Rtmirror(R;RR\RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s   cKs)tj| sttjddS(Nu2Only comparison operators may be used with ANY/ALL(RR[tAssertionErrorR R[(R;RR\RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s(R~R}RRRYRZRR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRW s !# RcBs&eZdZddZdZRS(cCsI||_tj|_||_||_d|_t|_ |j |_ dS(N( RRRRRuRvR&RIR'RJR(R;RRuRv((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s      cCs|S(N((R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa scCsBt|jttfr%|jjSt|j|j|jSdS(N(RRRR RsRRvRu(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs s N(R~R}RR&RaRs(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s RcBseZdZdZeZd d d dZdZeZ e dZ e dZ e dZdZdZd d Zd ZRS( uRepresent an expression that is ``LEFT RIGHT``. A :class:`.BinaryExpression` is generated automatically whenever two column expressions are used in a Python binary expression:: >>> from sqlalchemy.sql import column >>> column('a') + column('b') >>> print column('a') + column('b') a + b ubinarycCst|tjr$tj|}n||f|_|jd||_|jd||_||_ t j ||_ ||_ tj||_|dkri|_n ||_dS(NR`(RRt string_typesRt custom_opt_origRatlefttrightRuRR>RRvRRR&t modifiers(R;RaRbRuRRvRc((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s    cCsU|jtjtjfkrE|jt|jdt|jdStddS(Niiu+Boolean value of this clause is not defined(RuteqtneRR`Rx(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRy0 s*cCstj|jS(N(RR[Ru(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR[8 scCs|jj|jjS(N(RaRRb(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR< scKs.||j||_||j||_dS(N(RaRb(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^@ scKs|j|jfS(N(RaRb(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_D scKst|to|j|jko|jj|j|rQ|jj|j|ptj|jo|jj|j|o|jj|j|S(u[Compare this :class:`BinaryExpression` against the given :class:`BinaryExpression`.(RRRuRaR]RbRtis_commutative(R;R\R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR]G scCs'tj|j|rt|S|SdS(N(RRRuR(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRaY s c CsZ|jdk rCt|j|j|jd|jd|jd|jStt|j SdS(NRvRRc( RvR&RRaRbRuRRcRRs(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs_ s    N(R~R}RRR'RR&RRyRRR[RRR^R_R]RaRs(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s      tSlicecBs)eZdZdZdZddZRS(uRepresent SQL for a Python array-slice object. This is not a specific SQL construct at this level, but may be interpreted by specific dialects, e.g. PostgreSQL. uslicecCs+||_||_||_tj|_dS(N(tstarttstoptstepRRR(R;RhRiRj((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRw s   cCs|tjkst|S(N(RutgetitemR](R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa} sN(R~R}RRRR&Ra(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRgm s tIndexExpressioncBseZdZRS(uKRepresent the class of expressions that are like an "index" operation. (R~R}R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRl sRcBseZdZdZdZddZejdZ e dZ e dZ e dZdZe d Zd Zd Zd Zd ZRS(u/Represent a grouping within a column expressionugroupingcCs%||_t|dtj|_dS(Nutype(RRRRR(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s cCs|S(N((R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa scCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCs|jS(N(R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCst|jddp|jS(Nu_label(RRR&R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scKs||j||_dS(N(R(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^ scKs |jfS(N(R(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_ scCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCst|j|S(N(RR(R;tattr((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCsi|jd6|jd6S(Nuelementutype(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRD scCs|d|_|d|_dS(Nuelementutype(RR(R;tstate((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt __setstate__ s cKs"t|to!|jj|jS(N(RRRR](R;R\R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR] sN(R~R}RRRR&RaRRRRRRRR^R_RRRDRoR](((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s       uRANGE_UNBOUNDEDu RANGE_CURRENTtOvercBseZdZdZd Zd Zd Zd d d d dZdZ e e j dddZ e jdZdZed Ze d ZRS( uRepresent an OVER clause. This is a special operator against a so-called "window" function, as well as any aggregate function, which produces results relative to the result set itself. It's supported only by certain database backends. uovercCs||_|dk r6tdttj||_n|dk rctdttj||_n|r|j||_ |rt j dqd|_ n4|r|j||_ d|_ nd|_ |_ dS(uA Produce an :class:`.Over` object against a function. Used against aggregate or so-called "window" functions, for database backends that support window functions. :func:`~.expression.over` is usually called using the :meth:`.FunctionElement.over` method, e.g.:: func.row_number().over(order_by=mytable.c.some_column) Would produce:: ROW_NUMBER() OVER(ORDER BY some_column) Ranges are also possible using the :paramref:`.expression.over.range_` and :paramref:`.expression.over.rows` parameters. These mutually-exclusive parameters each accept a 2-tuple, which contains a combination of integers and None:: func.row_number().over( order_by=my_table.c.some_column, range_=(None, 0)) The above would produce:: ROW_NUMBER() OVER(ORDER BY some_column RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) A value of None indicates "unbounded", a value of zero indicates "current row", and negative / positive integers indicate "preceding" and "following": * RANGE BETWEEN 5 PRECEDING AND 10 FOLLOWING:: func.row_number().over(order_by='x', range_=(-5, 10)) * ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW:: func.row_number().over(order_by='x', rows=(None, 0)) * RANGE BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING:: func.row_number().over(order_by='x', range_=(-2, None)) * RANGE BETWEEN 1 FOLLOWING AND 3 FOLLOWING:: func.row_number().over(order_by='x', range_=(1, 3)) .. versionadded:: 1.1 support for RANGE / ROWS within a window :param element: a :class:`.FunctionElement`, :class:`.WithinGroup`, or other compatible construct. :param partition_by: a column element or string, or a list of such, that will be used as the PARTITION BY clause of the OVER construct. :param order_by: a column element or string, or a list of such, that will be used as the ORDER BY clause of the OVER construct. :param range\_: optional range clause for the window. This is a tuple value which can contain integer values or None, and will render a RANGE BETWEEN PRECEDING / FOLLOWING clause .. versionadded:: 1.1 :param rows: optional rows clause for the window. This is a tuple value which can contain integer values or None, and will render a ROWS BETWEEN PRECEDING / FOLLOWING clause. .. versionadded:: 1.1 This function is also available from the :data:`~.expression.func` construct itself via the :meth:`.FunctionElement.over` method. .. seealso:: :data:`.expression.func` :func:`.expression.within_group` Ru*'range_' and 'rows' are mutually exclusiveN( RR&RRKRtto_listtorder_byt partition_byt_interpret_rangetrange_R R[trows(R;RRsRrRuRv((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s"S      cCst|t s"t|dkr4tjdn|ddkrMt}nLyt|d}Wn tk rtjdnX|dkrt }n|ddkrt}nLyt|d}Wn tk rtjdnX|dkrt }n||fS(Niu2-tuple expected for range/rowsiu(Integer or None expected for range valuei( RttupleRYR R[R&tRANGE_UNBOUNDEDtintt ValueErrort RANGE_CURRENT(R;Rutlowertupper((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRt@ s*"          u1.1uthe :attr:`.Over.func` member of the :class:`.Over` class is deprecated and will be removed in a future release. Please refer to the :attr:`.Over.element` attribute.cCs|jS(uIthe element referred to by this :class:`.Over` clause. (R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytfunc` s cCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRo scKs5g|j|j|jfD]}|dk r|^qS(N(RRsRrR&(R;RSR<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_s scKsg||j||_|jdk r<||j||_n|jdk rc||j||_ndS(N(RRsR&Rr(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^z s cCsGttjg|j|j|jfD]}|dk r"|j^q"S(N(RRRRRsRrR&R(R;R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s N(R~R}RRR&RrRsRRRtRRRR~RRR_RR^R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRp s l    t WithinGroupcBsneZdZdZdZdZdddddZej dZ dZ e dZ edZRS( uRepresent a WITHIN GROUP (ORDER BY) clause. This is a special operator against so-called "ordered set aggregate" and "hypothetical set aggregate" functions, including ``percentile_cont()``, ``rank()``, ``dense_rank()``, etc. It's supported only by certain database backends, such as PostgreSQL, Oracle and MS SQL Server. The :class:`.WithinGroup` construct extracts its type from the method :meth:`.FunctionElement.within_group_type`. If this returns ``None``, the function's ``.type`` is used. u withingroupcGs:||_|dk r6tdttj||_ndS(uProduce a :class:`.WithinGroup` object against a function. Used against so-called "ordered set aggregate" and "hypothetical set aggregate" functions, including :class:`.percentile_cont`, :class:`.rank`, :class:`.dense_rank`, etc. :func:`~.expression.within_group` is usually called using the :meth:`.FunctionElement.within_group` method, e.g.:: from sqlalchemy import within_group stmt = select([ department.c.id, func.percentile_cont(0.5).within_group( department.c.salary.desc() ) ]) The above statement would produce SQL similar to ``SELECT department.id, percentile_cont(0.5) WITHIN GROUP (ORDER BY department.salary DESC)``. :param element: a :class:`.FunctionElement` construct, typically generated by :data:`~.expression.func`. :param \*order_by: one or more column elements that will be used as the ORDER BY clause of the WITHIN GROUP construct. .. versionadded:: 1.1 .. seealso:: :data:`.expression.func` :func:`.expression.over` RN(RR&RRKRRqRr(R;RRr((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s$  c Cs"t|d|d|d|d|S(uProduce an OVER clause against this :class:`.WithinGroup` construct. This function has the same signature as that of :meth:`.FunctionElement.over`. RsRrRuRv(Rp(R;RsRrRuRv((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pytover s cCs0|jj|}|dk r"|S|jjSdS(N(Rtwithin_group_typeR&R(R;twgt((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s cKs/g|j|jfD]}|dk r|^qS(N(RRrR&(R;RSR<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_ scKs@||j||_|jdk r<||j||_ndS(N(RRrR&(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^ scCsAttjg|j|jfD]}|dk r|j^qS(N(RRRRRrR&R(R;R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s N(R~R}RRR&RrRRRRRR_RR^RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s +  tFunctionFiltercBseZdZdZd ZdZdZd d d d dZd dZ e j dZ dZ edZed ZRS( uRepresent a function FILTER clause. This is a special operator against aggregate and window functions, which controls which rows are passed to it. It's supported only by certain database backends. Invocation of :class:`.FunctionFilter` is via :meth:`.FunctionElement.filter`:: func.count(1).filter(True) .. versionadded:: 1.0.0 .. seealso:: :meth:`.FunctionElement.filter` u funcfiltercGs||_|j|dS(uProduce a :class:`.FunctionFilter` object against a function. Used against aggregate and window functions, for database backends that support the "FILTER" clause. E.g.:: from sqlalchemy import funcfilter funcfilter(func.count(1), MyClass.name == 'some name') Would produce "COUNT(1) FILTER (WHERE myclass.name = 'some name')". This function is also available from the :data:`~.expression.func` construct itself via the :meth:`.FunctionElement.filter` method. .. versionadded:: 1.0.0 .. seealso:: :meth:`.FunctionElement.filter` N(R~tfilter(R;R~t criterion((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs cGsRxKt|D]=}t|}|jdk rA|j|@|_q ||_q W|S(u Produce an additional FILTER against the function. This method adds additional criteria to the initial criteria set up by :meth:`.FunctionElement.filter`. Multiple criteria are joined together at SQL render time via ``AND``. N(RRRR&(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR.s   c Cs"t|d|d|d|d|S(uProduce an OVER clause against this filtered function. Used against aggregate or so-called "window" functions, for database backends that support window functions. The expression:: func.rank().filter(MyClass.y > 5).over(order_by='x') is shorthand for:: from sqlalchemy import over, funcfilter over(funcfilter(func.rank(), MyClass.y > 5), order_by='x') See :func:`~.expression.over` for a full description. RsRrRuRv(Rp(R;RsRrRuRv((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRDs cCs'tjtj|rt|S|SdS(N(RRt filter_opR(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRa^s cCs |jjS(N(R~R(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRdscKs/g|j|jfD]}|dk r|^qS(N(R~RR&(R;RSR<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_hscKs@||j||_|jdk r<||j||_ndS(N(R~RR&(R;RHR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^kscCsAttjg|j|jfD]}|dk r|j^qS(N(RRRR~RR&R(R;R<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRps N(R~R}RRR&RRRRRaRRRR_RR^RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR s     RcBseZdZdZddZdZejdZ ejdZ e dZ ejdZ ejdZdd Zd Zd Ze d Ze d ZdZeedZe dZddZRS(uRepresents a column label (AS). Represent a label, as typically applied to any column-level element using the ``AS`` sql keyword. ulabelcCst|tr|j|_nxt|tr<|j}q!W|r[||_|j|_n+tdt|t|ddf|_|j|_ |_|_ ||_ ||_ |g|_ dS(uReturn a :class:`Label` object for the given :class:`.ColumnElement`. A label changes the name of an element in the columns clause of a ``SELECT`` statement, typically via the ``AS`` SQL keyword. This functionality is more conveniently available via the :meth:`.ColumnElement.label` method on :class:`.ColumnElement`. :param name: label name :param obj: a :class:`.ColumnElement`. u %%(%d %s)sunameuanonN(RRRRRRRRRR,Rt_elementt_typeR(R;RRR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs  (  cCs|j|j|j|jffS(N(R2RRR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt __reduce__scCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|S(N((R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs%tj|jp!t|jddS(Nutype(RR>RRRR&(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|jjdtjS(NR`(RRaRtas_(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|j|jjd|S(NR`(t_apply_to_innerRRa(R;R`((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRascCs|j|jjS(N(RRRs(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsscOs?|||}||jk r7t|j|d|jS|SdS(NR(RRRR(R;tfnR(Rt sub_element((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscKs |jfS(N(R(R;RS((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR_scKs||j||_|jjdd|jjdd|rtdt|t|jddf|_|_ |j|_ |_ |_ ndS(Nuelementu_allow_label_resolveu %%(%d %s)sunameuanon( RR4RBR&RRRRRRR,RR(R;RHtanonymize_labelsR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR^s/cCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscKs_|jj|d|r|n|jdt}|jj||jdk r[|j|_n|S(NRtdisallow_is_literal( RRRR'RRRR&R(R;RRRte((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs  N(R~R}RRR&RRRRRRRRRRRaRsRRRR_RR+R^RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR}s$ #      RcBseZdZdZdZZZZe Z e j Z de ddZdZdZdZeeeZe dZe jdZe dZe d Ze d Zd Zdd Zdee e d ZRS(uRepresents a column expression from any textual string. The :class:`.ColumnClause`, a lightweight analogue to the :class:`.Column` class, is typically invoked using the :func:`.column` function, as in:: from sqlalchemy import column id, name = column("id"), column("name") stmt = select([id, name]).select_from("user") The above statement would produce SQL like:: SELECT id, name FROM user :class:`.ColumnClause` is the immediate superclass of the schema-specific :class:`.Column` object. While the :class:`.Column` class has all the same capabilities as :class:`.ColumnClause`, the :class:`.ColumnClause` class is usable by itself in those cases where behavioral requirements are limited to simple SQL expression generation. The object has none of the associations with schema-level metadata or with execution-time behavior that :class:`.Column` does, so in that sense is a "lightweight" version of :class:`.Column`. Full details on :class:`.ColumnClause` usage is at :func:`.column`. .. seealso:: :func:`.column` :class:`.Column` ucolumncCs8||_|_||_tj||_||_dS(uC Produce a :class:`.ColumnClause` object. The :class:`.ColumnClause` is a lightweight analogue to the :class:`.Column` class. The :func:`.column` function can be invoked with just a name alone, as in:: from sqlalchemy import column id, name = column("id"), column("name") stmt = select([id, name]).select_from("user") The above statement would produce SQL like:: SELECT id, name FROM user Once constructed, :func:`.column` may be used like any other SQL expression element such as within :func:`.select` constructs:: from sqlalchemy.sql import column id, name = column("id"), column("name") stmt = select([id, name]).select_from("user") The text handled by :func:`.column` is assumed to be handled like the name of a database column; if the string contains mixed case, special characters, or matches a known reserved word on the target backend, the column expression will render using the quoting behavior determined by the backend. To produce a textual SQL expression that is rendered exactly without any quoting, use :func:`.literal_column` instead, or pass ``True`` as the value of :paramref:`.column.is_literal`. Additionally, full SQL statements are best handled using the :func:`.text` construct. :func:`.column` can be used in a table-like fashion by combining it with the :func:`.table` function (which is the lightweight analogue to :class:`.Table`) to produce a working table construct with minimal boilerplate:: from sqlalchemy import table, column, select user = table("user", column("id"), column("name"), column("description"), ) stmt = select([user.c.description]).where(user.c.name == 'wendy') A :func:`.column` / :func:`.table` construct like that illustrated above can be created in an ad-hoc fashion and is not associated with any :class:`.schema.MetaData`, DDL, or events, unlike its :class:`.Table` counterpart. .. versionchanged:: 1.0.0 :func:`.expression.column` can now be imported from the plain ``sqlalchemy`` namespace like any other SQL element. :param text: the text of the element. :param type: :class:`.types.TypeEngine` object which can associate this :class:`.ColumnClause` with a type. :param is_literal: if True, the :class:`.ColumnClause` is assumed to be an exact expression that will be delivered to the output with no quoting rules applied regardless of case sensitive settings. the :func:`.literal_column()` function essentially invokes :func:`.column` while passing ``is_literal=True``. .. seealso:: :class:`.Column` :func:`.literal_column` :func:`.table` :func:`.text` :ref:`sqlexpression_literal_column` N(R,RttableRR>RR<(R;RRR<R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR!sS cCs|jsg|jdksg|jjsgt|d sgt|tr|jsg|jdksg|jjrt|dr|j|jkpt|do|j|jkS|j j |j SdS(Nu proxy_setunameu_label( R<RR&t_textualRqRRRRRR(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRys    !cCs |jdS(Nutable(R4(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _get_tablescCs!|jj|||jd|dks:|j|kr>|Stt|j||}||_|S(N(R&RRRRR3(R R(RR;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR3bs  cCsttj||jffS(N(RRt text_typeR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsscCs$|jr |Stj|jSdS(N(RRRR|(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_memoized_method_lowervs cCs$|jr |Stj|jSdS(N(RRRR}(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_memoized_method_upper|s cCs5|jdd}tjs-|jd}nd|S(Nuasciiubackslashreplaceu'%s'(RkRtpy2ktdecode(R;t backslashed((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR|s (uquoteuloweruupper( R~R}Rt __slots__R3RRRR|(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR0s.    t_truncated_labelcBs2eZdZdZddZdZdZRS(uVA unicode subclass used to identify symbolic " "names that may require truncation.cCs.t|d|}tt|j|||S(Nuquote(RRRR3(R R(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR3scCs|jtj||jffS(N(R2RRR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs|S(N((R;tmap_((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt apply_maps(N(R~R}RRR&R3RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs   tconvcBseZdZdZRS(uMark a string indicating that a name has already been converted by a naming convention. This is a string subclass that indicates a name that should not be subject to any further naming conventions. E.g. when we create a :class:`.Constraint` using a naming convention as follows:: m = MetaData(naming_convention={ "ck": "ck_%(table_name)s_%(constraint_name)s" }) t = Table('t', m, Column('x', Integer), CheckConstraint('x > 5', name='x5')) The name of the above constraint will be rendered as ``"ck_t_x5"``. That is, the existing name ``x5`` is used in the naming convention as the ``constraint_name`` token. In some situations, such as in migration scripts, we may be rendering the above :class:`.CheckConstraint` with a name that's already been converted. In order to make sure the name isn't double-modified, the new name is applied using the :func:`.schema.conv` marker. We can use this explicitly as follows:: m = MetaData(naming_convention={ "ck": "ck_%(table_name)s_%(constraint_name)s" }) t = Table('t', m, Column('x', Integer), CheckConstraint('x > 5', name=conv('ck_t_x5'))) Where above, the :func:`.schema.conv` marker indicates that the constraint name here is final, and the name will render as ``"ck_t_x5"`` and not ``"ck_t_ck_t_x5"`` .. versionadded:: 0.9.4 .. seealso:: :ref:`constraint_naming_conventions` ((R~R}RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs+t _defer_namecBs&eZdZdZdZdZRS(uRmark a name as 'deferred' for the purposes of automated name generation. cCs@|dkrtSt|tr#|Stt|j||SdS(N(R&t _NONE_NAMERRRRR3(R R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR3s  cCs|jtj|ffS(N(R2RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs((R~R}RRR3R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs t_defer_none_namecBseZdZdZRS(u>indicate a 'deferred' name that was ultimately the value None.((R~R}RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRsu _unnamed_RcBs/eZdZdZdZdZdZRS(uDA unicode subclass used to identify anonymously generated names.cCs.tttjj|tj||jS(N(RRRRt__add__R(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs.tttjjtj|||jS(N(RRRRRR(R;R\((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt__radd__scCs/|jdk r#t|||jS||SdS(N(RR&R(R;R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs((R~R}RRRRR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs   cCs!t|tr|St|SdS(ucoerce the given value to :class:`._truncated_label`. Existing :class:`._truncated_label` and :class:`._anonymous_label` objects are passed unchanged. N(RR(R(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR scCsAt|tjr|Syt|SWntk r<d|SXdS(Nuunprintable element %r(RRR^Rit Exception(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_string_or_unprintables  cCs#tjg|D]}|j^q S(u\expand the given set of ClauseElements to be the set of all 'cloned' predecessors. (RRR6(telementsR:((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_expand_cloned#scCs#tjg|D]}|j^q S(uXexpand tables into individual columns in the given list of column expressions. (RRR(RR<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_select_iterables+scs;tt|jt|tfd|DS(ureturn the intersection of sets a and b, counting any overlap between 'cloned' predecessors. The returned set is in terms of the entities present within 'a'. c3s'|]}j|jr|VqdS(N(RR6(Rtelem(t all_overlap(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pys <s(R RR(taR((RsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_cloned_intersection3s!cs;tt|jt|tfd|DS(Nc3s'|]}j|js|VqdS(N(RR6(RR(R(sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pys Cs(R RR(RR((RsJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_cloned_difference@s!usqlalchemy.sql.functionscCs7t|d s"t||jr/|jdS|SdS(Nuname(RqRtFunctionElementRR&(t functionsR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_labeledGs cCs t|tS(u:True if ``col`` is an instance of :class:`.ColumnElement`.(RR8(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _is_columnQscCs*tj}t|ii|jd6|S(u2locate Column objects within the given expression.ucolumn(RR>R R?(R/R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _find_columnsWs cCsXt|tjr|St|dr4|j}ny |jSWntk rSdSXdS(Nu__clause_element__(RRR^Rqt__clause_element__R,RR&(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_column_as_keyjs  cCs!t|dr|jS|SdS(Nu__clause_element__(RqR(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_clause_element_as_exprus cCsDt|tjrt|St|dr:|j}nt|S(Nu__clause_element__(RRR^RGRqRR(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRK|s  cCspt|tjrt|St|dr:|j}nt|trb|jdk rbt |St |SdS(Nu__clause_element__( RRR^RGRqRR8RR&RFR(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt&_literal_and_labels_as_label_references  cCs t|S(N(R(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCst|tr|St|dr,|jSt|tjrH||St|tjtfrjt|St j dt |dS(Nu__clause_element__u=SQL expression object expected, got object of type %r instead( RR RqRRR^tNoneTypeRt _const_exprR R[R(Rt text_fallback((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _literal_ass   cCs$|rt|tSt|tSdS(N(RRt_no_text_coercion(Rtallow_coercion_to_text((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs cCs t|tS(N(RR(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_literal_as_columnscCsVt|}tj| }tjditj|d6|rDdndd6dS(NuTextual column expression %(column)r should be explicitly declared with text(%(column)r), or use %(literal_column)s(%(column)r) for more specificityucolumnuliteral_column(Rit_guess_straight_columntmatchR R[Rtellipses_string(Rtguess_is_literal((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_no_column_coercions  cCs;|ditj|d6|r)d|ndd6dS(NuX%(extra)sTextual SQL expression %(expr)r should be explicitly declared as text(%(expr)r)uexpru%s uuextra(RR(Rtexc_clstextra((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs cCsIt|dr|jSt|tsAtjd|fn|SdS(Nu__clause_element__uAmbiguous literal: %r. Use the 'text()' function to indicate a SQL expression literal, or 'literal()' to indicate a bound value.(RqRRR R R[(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR5s cCst|t ot|d S(Nu__clause_element__(RR Rq(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt _is_literalscCs!|dkrdSt||SdS(N(R&t_only_column_elements(RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_only_column_elements_or_nones cCsVt|dr|j}nt|tsRtjd||t|fn|S(Nu__clause_element__uMColumn-based expression object expected for argument '%s'; got: '%s', type %s(RqRRR8R R[R(RR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRscCs_t|dr|jSt|tsW|dkr;tSt||d|dtSn|SdS(Nu__clause_element__RR$(RqRRR R&R R%R'(RRR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs  u^\w\S*$cCst|tr|St|dr,|jStj|dt}|dkrrt|tj t frt |Snt|dr|j S|dkrt }n2t|tjrtt|dt St|t|d|S(Nu__clause_element__traiseerru selectableu*R<(RR RqRR tinspectR+R&RRRRRR'tnumberstNumberRRiR(RtinspR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_interpret_as_column_or_froms       cCsht|tttfr|S|dkr/tS|tkrBtS|tkrUtStjddS(NuExpected None, False, or True( RR R RR&R+R'R R[(R((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRs   cCs/x(|D]}|jjs|jSqWtjSdS(N(Rt_isnullRR(targsR((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_type_from_args+s   cCsS|j|d|}|dkrOtjd|t|dd|jfn|S(Ntrequire_embeddedubGiven column '%s', attached to table '%s', failed to locate a corresponding column from table '%s'utable(tcorresponding_columnR&R tInvalidRequestErrorRRz(t fromclauseRMRR<((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt_corresponding_column_or_error3s %tAnnotatedColumnElementcBsteZdZdZejdZejdZejdZejdZ ejdZ RS(cCsftj|||tjj|x<dD]4}|jj|tdkr*|jj |q*q*WdS(Nunameukeyutable(unameukeyutable( RRR8R9R7R4RR+R&RB(R;RRERm((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRAs  cCs,tt|j|}tjj||S(N(RRRGR8R9R7(R;RERH((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRGHscCs |jjS(u'pull 'name' from parent, if not present(t_Annotated__elementR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRMscCs |jjS(u(pull 'table' from parent, if not present(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyRRscCs |jjS(u&pull 'key' from parent, if not present(RR,(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR,WscCs |jjS(N(Rtinfo(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR\scCs |jjS(N(RR(R;((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR`s( R~R}RRGRRRRR,RR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyR@s  (xRt __future__RRRRuRtRRt annotationRtbaseRRRRRtvisitorsR R R R R RRRRR+R!R&R)R-R0t_self_inspectsR1tColumnOperatorsR8R%RRR R RRR&RmRoR.R3R=RR@RCRFRGRwRWRRRgRlRtsymbolRxR{RpRRRRRRRRRt MemoizedSlotsRRRRRRRt_generated_labelRRRRRRRRRRRRRRKRRRRRRR[RR5RRRRRftIRRRRRR(((sJ/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/sql/elements.pyt s        6  dqy ;B]  7 !ak /^g2my Y0