HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyc
�
���ec	@s'dZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"dd lm#Z#dd!l$m%Z%dd"l$m&Z&dd#l$m'Z'dd$l$m(Z(dd%l$m)Z)dd&l$m*Z*dd'l$m+Z+dd(l$m,Z,dd)l$m-Z-dd*l$m.Z.dd+l$m/Z/dd,l$m0Z0dd-lm1Z1d.d/lm2Z2d.d0lm3Z3d.d1l4m5Z5d2e'fd3��YZ6e3j7d4d5�d6��Z8d7ej9e)fd8��YZ:d9e:fd:��YZ;d;e<fd<��YZ=d=e<fd>��YZ>d?e<fd@��YZ?dAej@e;fdB��YZAe3jBdCdD�ZCe3jBdEdF�ZDe3jBdGdH�ZEeEZFdIejGeAfdJ��YZHdKe<fdL��YZIdMeIeAfdN��YZJdOejGeJfdP��YZKdQeKfdR��YZLdSeJfdT��YZMdUeJfdV��YZNdWejGejOee=e>eJfdX��YZPdYejQfdZ��YZRd[eJfd\��YZSd]e,eAfd^��YZTd_ejGe!eAfd`��YZUdae)fdb��YZVdceeAfdd��YZWdeejXejYejZej[eReee;fdf��YZ\dge,e\fdh��YZ]die<fdj��YZ^dke^e\fdl��YZ_ej`dmdn�doefdp��Y�Zadqee_fdr��YZbdse<fdt��YZcej`dmdu�dve3jdefdw��Y�Zedxe<fdy��YZfdze	jge	jhejifd{��YZjd|e=e>e?eecefe_fd}��YZkd~ej[ee-fd��YZld�e0fd���YZmd�e\fd���YZnenZod�e
fd���YZpdS(�stThe :class:`_expression.FromClause` class of SQL expression elements,
representing
SQL tables and derived rowsets.

i����N(t
attrgetteri(t	coercions(t	operators(troles(t
traversals(ttype_api(tvisitors(t	Annotated(tSupportsCloneAnnotations(t_clone(t_cloned_difference(t_cloned_intersection(t_entity_namespace_key(t_expand_cloned(t
_from_objects(t_generative(t_select_iterables(tCacheableOptions(tColumnCollection(t	ColumnSet(tCompileState(tDedupeColumnCollection(t
Executable(t
Generative(tHasCompileState(tHasMemoized(t	Immutable(tprefix_anon_map(t_document_text_coercion(t_anonymous_label(tand_(t
BindParameter(tBooleanClauseList(t
ClauseElement(t
ClauseList(tColumnClause(tGroupedElement(tGrouping(tliteral_column(tTableValuedColumn(tUnaryExpression(tInternalTraversali(texc(tutil(tinspectt_OffsetLimitParamcBseZeZed��ZRS(cCs|jS(N(teffective_value(tself((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_limit_offset_valueCs(t__name__t
__module__tTruet
inherit_cachetpropertyR0(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR-@ss1.4szThe standalone :func:`.subquery` function is deprecated and will be removed in a future release.  Use select().subquery().cOstj||�j|�S(sReturn an :class:`.Subquery` object derived
    from a :class:`_expression.Select`.

    :param alias: the alias name for the subquery

    :param \*args, \**kwargs:  all other arguments are passed through to the
     :func:`_expression.select` function.

    (tSelecttcreate_legacy_selecttsubquery(taliastargstkwargs((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR8HstReturnsRowscBsSeZdZeZeZeZeZe	d��Z
e	d��Ze	d��ZRS(s�The base-most class for Core constructs that have some concept of
    columns that can represent rows.

    While the SELECT statement and TABLE are the primary things we think
    of in this category,  DML like INSERT, UPDATE and DELETE can also specify
    RETURNING which means they can be used in CTEs and other forms, and
    PostgreSQL has functions that return rows also.

    .. versionadded:: 1.4

    cCs|S(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
selectablenscCs
t��dS(sEA sequence of column expression objects that represents the
        "selected" columns of this :class:`_expression.ReturnsRows`.

        This is typically equivalent to .exported_columns except it is
        delivered in the form of a straight sequence and not  keyed
        :class:`_expression.ColumnCollection`.

        N(tNotImplementedError(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_all_selected_columnsrs
cCs
t��dS(sA :class:`_expression.ColumnCollection`
        that represents the "exported"
        columns of this :class:`_expression.ReturnsRows`.

        The "exported" columns represent the collection of
        :class:`_expression.ColumnElement`
        expressions that are rendered by this SQL
        construct.   There are primary varieties which are the
        "FROM clause columns" of a FROM clause, such as a table, join,
        or subquery, the "SELECTed columns", which are the columns in
        the "columns clause" of a SELECT statement, and the RETURNING
        columns in a DML statement..

        .. versionadded:: 1.4

        .. seealso::

            :attr:`_expression.FromClause.exported_columns`

            :attr:`_expression.SelectBase.exported_columns`
        N(R>(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytexported_columns~s(
R1R2t__doc__R3t_is_returns_rowstFalset_is_from_clauset_is_select_statementt_is_lateralR5R=R?R@(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR<Zst
SelectablecBsheZdZdZeZd�Zd
d�Ze	j
ddd�e	jd�d���Ze
d	�ZRS(s!Mark a class as being selectable.R=cCs
t��dS(N(R>(R/tcolumn((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_refresh_for_new_column�scCstj||�S(sZReturn a LATERAL alias of this :class:`_expression.Selectable`.

        The return value is the :class:`_expression.Lateral` construct also
        provided by the top-level :func:`_expression.lateral` function.

        .. versionadded:: 1.1

        .. seealso::

            :ref:`tutorial_lateral_correlation` -  overview of usage.

        (tLateralt
_construct(R/tname((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytlateral�s
s1.4tmessages�The :meth:`.Selectable.replace_selectable` method is deprecated, and will be removed in a future release.  Similar functionality is available via the sqlalchemy.sql.visitors module.ssqlalchemy.sql.utilcCstjjj|�j|�S(s�Replace all occurrences of :class:`_expression.FromClause`
        'old' with the given :class:`_expression.Alias`
        object, returning a copy of this :class:`_expression.FromClause`.

        (R+t	preloadedtsql_utilt
ClauseAdapterttraverse(R/toldR9((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytreplace_selectable�s
cCs|jj||�S(s�Given a :class:`_expression.ColumnElement`, return the exported
        :class:`_expression.ColumnElement` object from the
        :attr:`_expression.Selectable.exported_columns`
        collection of this :class:`_expression.Selectable`
        which corresponds to that
        original :class:`_expression.ColumnElement` via a common ancestor
        column.

        :param column: the target :class:`_expression.ColumnElement`
                      to be matched.

        :param require_embedded: only return corresponding columns for
         the given :class:`_expression.ColumnElement`, if the given
         :class:`_expression.ColumnElement`
         is actually present within a sub-element
         of this :class:`_expression.Selectable`.
         Normally the column will match if
         it merely shares a common ancestor with one of the exported
         columns of this :class:`_expression.Selectable`.

        .. seealso::

            :attr:`_expression.Selectable.exported_columns` - the
            :class:`_expression.ColumnCollection`
            that is used for the operation.

            :meth:`_expression.ColumnCollection.corresponding_column`
            - implementation
            method.

        (R@tcorresponding_column(R/RHtrequire_embedded((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRU�s!	N(R1R2RAt__visit_name__R3t
is_selectableRItNoneRMR+t
deprecatedtpreload_moduleRTRCRU(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRG�s		tHasPrefixescBsMeZdZdejfgZeeddd�d���Zdd�Z
RS(t	_prefixestexprs+:meth:`_expression.HasPrefixes.prefix_with`s*:paramref:`.HasPrefixes.prefix_with.*expr`cOsK|jdd�}|r7tjddj|���n|j||�dS(s�Add one or more expressions following the statement keyword, i.e.
        SELECT, INSERT, UPDATE, or DELETE. Generative.

        This is used to support backend-specific prefix keywords such as those
        provided by MySQL.

        E.g.::

            stmt = table.insert().prefix_with("LOW_PRIORITY", dialect="mysql")

            # MySQL 5.7 optimizer hints
            stmt = select(table).prefix_with(
                "/*+ BKA(t1) */", dialect="mysql")

        Multiple prefixes can be specified by multiple calls
        to :meth:`_expression.HasPrefixes.prefix_with`.

        :param \*expr: textual or :class:`_expression.ClauseElement`
         construct which
         will be rendered following the INSERT, UPDATE, or DELETE
         keyword.
        :param \**kw: A single keyword 'dialect' is accepted.  This is an
         optional string dialect name which will
         limit rendering of this prefix to only that dialect.

        tdialectsUnsupported argument(s): %st,N(tpopRYR*t
ArgumentErrortjoint_setup_prefixes(R/R^tkwR_((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytprefix_with�s
!cCsB|jtg|D]!}tjtj|�|f^q�|_dS(N(R]ttupleRtexpectRtStatementOptionRole(R/tprefixesR_tp((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRds	(N(R1R2R]R)tdp_prefix_sequencet _has_prefixes_traverse_internalsRRRfRYRd(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR\�s$tHasSuffixescBsMeZdZdejfgZeeddd�d���Zdd�Z
RS(t	_suffixesR^s+:meth:`_expression.HasSuffixes.suffix_with`s*:paramref:`.HasSuffixes.suffix_with.*expr`cOsK|jdd�}|r7tjddj|���n|j||�dS(sAdd one or more expressions following the statement as a whole.

        This is used to support backend-specific suffix keywords on
        certain constructs.

        E.g.::

            stmt = select(col1, col2).cte().suffix_with(
                "cycle empno set y_cycle to 1 default 0", dialect="oracle")

        Multiple suffixes can be specified by multiple calls
        to :meth:`_expression.HasSuffixes.suffix_with`.

        :param \*expr: textual or :class:`_expression.ClauseElement`
         construct which
         will be rendered following the target clause.
        :param \**kw: A single keyword 'dialect' is accepted.  This is an
         optional string dialect name which will
         limit rendering of this suffix to only that dialect.

        R_sUnsupported argument(s): %sR`N(RaRYR*RbRct_setup_suffixes(R/R^ReR_((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytsuffix_with&s
cCsB|jtg|D]!}tjtj|�|f^q�|_dS(N(RoRgRRhRRi(R/tsuffixesR_Rk((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRpIs	(N(R1R2RoR)Rlt _has_suffixes_traverse_internalsRRRqRYRp(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRnstHasHintscBsVeZej�ZdZdejfdejfgZ	dd�Z
edd��ZRS(t_statement_hintst_hintst*cCs|jd||�S(s�Add a statement hint to this :class:`_expression.Select` or
        other selectable object.

        This method is similar to :meth:`_expression.Select.with_hint`
        except that
        it does not require an individual table, and instead applies to the
        statement as a whole.

        Hints here are specific to the backend database and may include
        directives such as isolation levels, file directives, fetch directives,
        etc.

        .. versionadded:: 1.0.0

        .. seealso::

            :meth:`_expression.Select.with_hint`

            :meth:`_expression.Select.prefix_with` - generic SELECT prefixing
            which also can suit some database-specific HINT syntaxes such as
            MySQL optimizer hints

        N(t	with_hintRY(R/ttexttdialect_name((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytwith_statement_hint[scCs\|dkr'|j||ff7_n1|jji|tjtj|�|f6�|_dS(s�Add an indexing or other executional context hint for the given
        selectable to this :class:`_expression.Select` or other selectable
        object.

        The text of the hint is rendered in the appropriate
        location for the database backend in use, relative
        to the given :class:`_schema.Table` or :class:`_expression.Alias`
        passed as the
        ``selectable`` argument. The dialect implementation
        typically uses Python string substitution syntax
        with the token ``%(name)s`` to render the name of
        the table or alias. E.g. when using Oracle, the
        following::

            select(mytable).\
                with_hint(mytable, "index(%(name)s ix_mytable)")

        Would render SQL as::

            select /*+ index(mytable ix_mytable) */ ... from mytable

        The ``dialect_name`` option will limit the rendering of a particular
        hint to a particular backend. Such as, to add hints for both Oracle
        and Sybase simultaneously::

            select(mytable).\
                with_hint(mytable, "index(%(name)s ix_mytable)", 'oracle').\
                with_hint(mytable, "WITH INDEX ix_mytable", 'sybase')

        .. seealso::

            :meth:`_expression.Select.with_statement_hint`

        N(RYRuRvtunionRRhRtFromClauseRole(R/R=RyRz((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRxus
$	((
R1R2R+t
immutabledictRvRuR)tdp_statement_hint_listtdp_table_hint_listt_has_hints_traverse_internalsR{RRx(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRtRst
FromClausecBs�eZdZdZeZgZd Ze	Z
e	ZeZeZ
ejdd!dd"�d d��Zd eed�Zd ed	�Zd ed
�Zejd�d��Zd d d
�Zd�Zd�Zed��Zd�Zed��Zejd��Zed��Zejd��Z ejd��Z!d�Z"ee#d�dd�Z$ee#d��Z%d�Z&ed��Z'd�Z(d�Z)d ed�Z*RS(#sERepresent an element that can be used within the ``FROM``
    clause of a ``SELECT`` statement.

    The most common forms of :class:`_expression.FromClause` are the
    :class:`_schema.Table` and the :func:`_expression.select` constructs.  Key
    features common to all :class:`_expression.FromClause` objects include:

    * a :attr:`.c` collection, which provides per-name access to a collection
      of :class:`_expression.ColumnElement` objects.
    * a :attr:`.primary_key` attribute, which is a collection of all those
      :class:`_expression.ColumnElement`
      objects that indicate the ``primary_key`` flag.
    * Methods to generate various derivations of a "from" clause, including
      :meth:`_expression.FromClause.alias`,
      :meth:`_expression.FromClause.join`,
      :meth:`_expression.FromClause.select`.


    t
fromclausetwhereclauses2.0s�The :paramref:`_sql.FromClause.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.R;s�The :meth:`_sql.FromClause.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.cKs/|dk	r||d<ntj||g|�S(sTReturn a SELECT of this :class:`_expression.FromClause`.


        e.g.::

            stmt = some_table.select().where(some_table.c.id == 5)

        :param whereclause: a WHERE clause, equivalent to calling the
         :meth:`_sql.Select.where` method.

        :param \**kwargs: additional keyword arguments are passed to the
         legacy constructor for :class:`_sql.Select` described at
         :meth:`_sql.Select.create_legacy_select`.

        .. seealso::

            :func:`_expression.select` - general purpose
            method which allows for arbitrary column lists.

        R�N(RYR6t_create_select_from_fromclause(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytselect�s'
cCst|||||�S(s�Return a :class:`_expression.Join` from this
        :class:`_expression.FromClause`
        to another :class:`FromClause`.

        E.g.::

            from sqlalchemy import join

            j = user_table.join(address_table,
                            user_table.c.id == address_table.c.user_id)
            stmt = select(user_table).select_from(j)

        would emit SQL along the lines of::

            SELECT user.id, user.name FROM user
            JOIN address ON user.id = address.user_id

        :param right: the right side of the join; this is any
         :class:`_expression.FromClause` object such as a
         :class:`_schema.Table` object, and
         may also be a selectable-compatible object such as an ORM-mapped
         class.

        :param onclause: a SQL expression representing the ON clause of the
         join.  If left at ``None``, :meth:`_expression.FromClause.join`
         will attempt to
         join the two tables based on a foreign key relationship.

        :param isouter: if True, render a LEFT OUTER JOIN, instead of JOIN.

        :param full: if True, render a FULL OUTER JOIN, instead of LEFT OUTER
         JOIN.  Implies :paramref:`.FromClause.join.isouter`.

         .. versionadded:: 1.1

        .. seealso::

            :func:`_expression.join` - standalone function

            :class:`_expression.Join` - the type of object produced

        (tJoin(R/trighttonclausetisoutertfull((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRc�s,cCst|||t|�S(sReturn a :class:`_expression.Join` from this
        :class:`_expression.FromClause`
        to another :class:`FromClause`, with the "isouter" flag set to
        True.

        E.g.::

            from sqlalchemy import outerjoin

            j = user_table.outerjoin(address_table,
                            user_table.c.id == address_table.c.user_id)

        The above is equivalent to::

            j = user_table.join(
                address_table,
                user_table.c.id == address_table.c.user_id,
                isouter=True)

        :param right: the right side of the join; this is any
         :class:`_expression.FromClause` object such as a
         :class:`_schema.Table` object, and
         may also be a selectable-compatible object such as an ORM-mapped
         class.

        :param onclause: a SQL expression representing the ON clause of the
         join.  If left at ``None``, :meth:`_expression.FromClause.join`
         will attempt to
         join the two tables based on a foreign key relationship.

        :param full: if True, render a FULL OUTER JOIN, instead of
         LEFT OUTER JOIN.

         .. versionadded:: 1.1

        .. seealso::

            :meth:`_expression.FromClause.join`

            :class:`_expression.Join`

        (R�R3(R/R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt	outerjoin's,cCstj||�S(stReturn an alias of this :class:`_expression.FromClause`.

        E.g.::

            a2 = some_table.alias('a2')

        The above code creates an :class:`_expression.Alias`
        object which can be used
        as a FROM clause in any SELECT statement.

        .. seealso::

            :ref:`tutorial_using_aliases`

            :func:`_expression.alias`

        (tAliasRK(R/RLtflat((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9Usssqlalchemy.sql.sqltypescCst|tj�S(sDReturn a :class:`_sql.TableValuedColumn` object for this
        :class:`_expression.FromClause`.

        A :class:`_sql.TableValuedColumn` is a :class:`_sql.ColumnElement` that
        represents a complete row in a table. Support for this construct is
        backend dependent, and is supported in various forms by backends
        such as PostgreSQL, Oracle and SQL Server.

        E.g.::

            >>> from sqlalchemy import select, column, func, table
            >>> a = table("a", column("id"), column("x"), column("y"))
            >>> stmt = select(func.row_to_json(a.table_valued()))
            >>> print(stmt)
            SELECT row_to_json(a) AS row_to_json_1
            FROM a

        .. versionadded:: 1.4.0b2

        .. seealso::

            :ref:`tutorial_functions` - in the :ref:`unified_tutorial`

        (R'Rt
TABLEVALUE(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyttable_valuedjscCstj||||�S(svReturn a TABLESAMPLE alias of this :class:`_expression.FromClause`.

        The return value is the :class:`_expression.TableSample`
        construct also
        provided by the top-level :func:`_expression.tablesample` function.

        .. versionadded:: 1.1

        .. seealso::

            :func:`_expression.tablesample` - usage guidelines and parameters

        (tTableSampleRK(R/tsamplingRLtseed((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyttablesample�scCs
||jkS(s�Return ``True`` if this :class:`_expression.FromClause` is
        'derived' from the given ``FromClause``.

        An example would be an Alias of a Table is derived from that Table.

        (t_cloned_set(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytis_derived_from�s
cCs|jj|j�S(s�Return ``True`` if this :class:`_expression.FromClause` and
        the other represent the same lexical identity.

        This tests if either one is a copy of the other, or
        if they are the same via annotation identity.

        (R�tintersection(R/tother((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_is_lexical_equivalent�scCst|d|jjd�S(s|A brief description of this :class:`_expression.FromClause`.

        Used primarily for error message formatting.

        RLs object(tgetattrt	__class__R1(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytdescription�scs'�jj�fd�|jD��dS(Nc3s|]}|j��VqdS(N(t_make_proxy(t.0tcol(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�s(t_columnst_populate_separate_keystc(R/R�((R�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt#_generate_fromclause_column_proxies�s	cCs|jS(s�A :class:`_expression.ColumnCollection`
        that represents the "exported"
        columns of this :class:`_expression.Selectable`.

        The "exported" columns for a :class:`_expression.FromClause`
        object are synonymous
        with the :attr:`_expression.FromClause.columns` collection.

        .. versionadded:: 1.4

        .. seealso::

            :attr:`_expression.Selectable.exported_columns`

            :attr:`_expression.SelectBase.exported_columns`


        (tcolumns(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR@�scCs3d|jkr&|j�|j�n|jj�S(s�A named-based collection of :class:`_expression.ColumnElement`
        objects maintained by this :class:`_expression.FromClause`.

        The :attr:`.columns`, or :attr:`.c` collection, is the gateway
        to the construction of SQL expressions using table-bound or
        other selectable-bound columns::

            select(mytable).where(mytable.c.somecolumn == 5)

        :return: a :class:`.ColumnCollection` object.

        R�(t__dict__t_init_collectionst_populate_column_collectionR�tas_immutable(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s

cCs|jS(s�Return a namespace used for name-based access in SQL expressions.

        This is the namespace that is used to resolve "filter_by()" type
        expressions, such as::

            stmt.filter_by(address='some address')

        It defaults to the ``.c`` collection, however internally it can
        be overridden using the "entity_namespace" annotation to deliver
        alternative results.

        (R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytentity_namespace�scCs|j�|j�|jS(spReturn the iterable collection of :class:`_schema.Column` objects
        which comprise the primary key of this :class:`_selectable.FromClause`.

        For a :class:`_schema.Table` object, this collection is represented
        by the :class:`_schema.PrimaryKeyConstraint` which itself is an
        iterable collection of :class:`_schema.Column` objects.

        (R�R�tprimary_key(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s


cCs|j�|j�|jS(sVReturn the collection of :class:`_schema.ForeignKey` marker objects
        which this FromClause references.

        Each :class:`_schema.ForeignKey` is a member of a
        :class:`_schema.Table`-wide
        :class:`_schema.ForeignKeyConstraint`.

        .. seealso::

            :attr:`_schema.Table.foreign_key_constraints`

        (R�R�tforeign_keys(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s

cCs4x-ddddgD]}|jj|d�qWdS(sReset the attributes linked to the ``FromClause.c`` attribute.

        This collection is separate from all the other memoized things
        as it has shown to be sensitive to being cleared out in situations
        where enclosing code, typically in a replacement traversal scenario,
        has already established strong relationships
        with the exported columns.

        The collection is cleared for the case where a table is having a
        column added to it as well as within a Join during copy internals.

        R�R�R�R�N(R�RaRY(R/tkey((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_reset_column_collectionsR�tdocs<
        A named-based collection of :class:`_expression.ColumnElement`
        objects maintained by this :class:`_expression.FromClause`.

        The :attr:`_sql.FromClause.c` attribute is an alias for the
        :attr:`_sql.FromClause.columns` attribute.

        :return: a :class:`.ColumnCollection`

        cCsgd|jkst�d|jks*t�d|jks?t�t�|_t�|_t�|_dS(NR�R�R�(R�tAssertionErrorRR�RR�tsetR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�4scCs
d|jkS(NR�(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_cols_populated=scCsdS(s�Called on subclasses to establish the .c collection.

        Each implementation has a different way of establishing
        this collection.

        N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�AtcCs|j�dS(sNGiven a column added to the .c collection of an underlying
        selectable, produce the local version of that column, assuming this
        selectable ultimately should proxy this column.

        this is used to "ping" a derived selectable to add a new column
        to its .c. collection when a Column has been added to one of the
        Table objects it ultimately derives from.

        If the given selectable hasn't populated its .c. collection yet,
        it should at least pass on the message to the contained selectables,
        but it will return None.

        This method is currently used by Declarative to allow Table
        columns to be added to a partially constructed inheritance
        mapping that may have already produced joins.  The method
        isn't public right now, as the full span of implications
        and/or caveats aren't yet clear.

        It's also possible that this functionality could be invoked by
        default via an event, which would require that
        selectables maintain a weak referencing collection of all
        derivations.

        N(R�(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRIIscCs|jd|�S(NRL(R9(R/RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_anonymous_fromclausedsN(s2.0s�The :paramref:`_sql.FromClause.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.(s2.0s�The :meth:`_sql.FromClause.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.(+R1R2RARWRCtnamed_with_columnt_hide_fromsRYtschemaR3RXRDt_is_joint_use_schema_mapR+tdeprecated_paramsR�RcR�R9R[R�R�R�R�R5R�R�R@tmemoized_propertyR�R�R�R�R�RR�t_select_iterableR�R�R�RIR�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��sN		..		
			
					tLABEL_STYLE_NONEsvLabel style indicating no automatic labeling should be applied to the
    columns clause of a SELECT statement.

    Below, the columns named ``columna`` are both rendered as is, meaning that
    the name ``columna`` can only refer to the first occurrence of this name
    within a result set, as well as if the statement were used as a subquery::

        >>> from sqlalchemy import table, column, select, true, LABEL_STYLE_NONE
        >>> table1 = table("table1", column("columna"), column("columnb"))
        >>> table2 = table("table2", column("columna"), column("columnc"))
        >>> print(select(table1, table2).join(table2, true()).set_label_style(LABEL_STYLE_NONE))
        SELECT table1.columna, table1.columnb, table2.columna, table2.columnc
        FROM table1 JOIN table2 ON true

    Used with the :meth:`_sql.Select.set_label_style` method.

    .. versionadded:: 1.4

tLABEL_STYLE_TABLENAME_PLUS_COLsMLabel style indicating all columns should be labeled as
    ``<tablename>_<columnname>`` when generating the columns clause of a SELECT
    statement, to disambiguate same-named columns referenced from different
    tables, aliases, or subqueries.

    Below, all column names are given a label so that the two same-named
    columns ``columna`` are disambiguated as ``table1_columna`` and
    ``table2_columna``::

        >>> from sqlalchemy import table, column, select, true, LABEL_STYLE_TABLENAME_PLUS_COL
        >>> table1 = table("table1", column("columna"), column("columnb"))
        >>> table2 = table("table2", column("columna"), column("columnc"))
        >>> print(select(table1, table2).join(table2, true()).set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL))
        SELECT table1.columna AS table1_columna, table1.columnb AS table1_columnb, table2.columna AS table2_columna, table2.columnc AS table2_columnc
        FROM table1 JOIN table2 ON true

    Used with the :meth:`_sql.GenerativeSelect.set_label_style` method.
    Equivalent to the legacy method ``Select.apply_labels()``;
    :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL` is SQLAlchemy's legacy
    auto-labeling style. :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY` provides a
    less intrusive approach to disambiguation of same-named column expressions.


    .. versionadded:: 1.4

tLABEL_STYLE_DISAMBIGUATE_ONLYs�Label style indicating that columns with a name that conflicts with
    an existing name should be labeled with a semi-anonymizing label
    when generating the columns clause of a SELECT statement.

    Below, most column names are left unaffected, except for the second
    occurrence of the name ``columna``, which is labeled using the
    label ``columna_1`` to disambiguate it from that of ``tablea.columna``::

        >>> from sqlalchemy import table, column, select, true, LABEL_STYLE_DISAMBIGUATE_ONLY
        >>> table1 = table("table1", column("columna"), column("columnb"))
        >>> table2 = table("table2", column("columna"), column("columnc"))
        >>> print(select(table1, table2).join(table2, true()).set_label_style(LABEL_STYLE_DISAMBIGUATE_ONLY))
        SELECT table1.columna, table1.columnb, table2.columna AS columna_1, table2.columnc
        FROM table1 JOIN table2 ON true

    Used with the :meth:`_sql.GenerativeSelect.set_label_style` method,
    :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY` is the default labeling style
    for all SELECT statements outside of :term:`1.x style` ORM queries.

    .. versionadded:: 1.4

R�cBs�eZdZdZdejfdejfdejfdejfdejfgZeZ	d'eed�Ze
d'ed��Ze
d'eed	��Zed
��Zd�Zd'd�Zejd
�d��Zed�Zd�Zd�Ze
d'd'd��Ze
d'd��Ze
ejd
�d���Ze
d��Zejdd(dd)�d'd��Z eej!dddde�d ���Z"ejd
�d'ed!��Z#ej!d"dd#�d'ed$��Z$ed%��Z%ed&��Z&RS(*s�Represent a ``JOIN`` construct between two
    :class:`_expression.FromClause`
    elements.

    The public constructor function for :class:`_expression.Join`
    is the module-level
    :func:`_expression.join()` function, as well as the
    :meth:`_expression.FromClause.join` method
    of any :class:`_expression.FromClause` (e.g. such as
    :class:`_schema.Table`).

    .. seealso::

        :func:`_expression.join`

        :meth:`_expression.FromClause.join`

    RctleftR�R�R�R�cCs�tjtj|dt�|_tjtj|dt�j�|_|dkrl|j	|j|j�|_
n'tjtj|�jdtj
�|_
||_||_dS(s�Construct a new :class:`_expression.Join`.

        The usual entrypoint here is the :func:`_expression.join`
        function or the :meth:`_expression.FromClause.join` method of any
        :class:`_expression.FromClause` object.

        t
deannotatetagainstN(RRhRR}R3R�t
self_groupR�RYt_match_primariesR�tOnClauseRoleRt_asboolR�R�(R/R�R�R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__init__�s	cCs||||dtd|�S(s�Return an ``OUTER JOIN`` clause element.

        The returned object is an instance of :class:`_expression.Join`.

        Similar functionality is also available via the
        :meth:`_expression.FromClause.outerjoin` method on any
        :class:`_expression.FromClause`.

        :param left: The left side of the join.

        :param right: The right side of the join.

        :param onclause:  Optional criterion for the ``ON`` clause, is
          derived from foreign key relationships established between
          left and right otherwise.

        To chain joins together, use the :meth:`_expression.FromClause.join`
        or
        :meth:`_expression.FromClause.outerjoin` methods on the resulting
        :class:`_expression.Join` object.

        R�R�(R3(tclsR�R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_outerjoin�scCs||||||�S(s6Produce a :class:`_expression.Join` object, given two
        :class:`_expression.FromClause`
        expressions.

        E.g.::

            j = join(user_table, address_table,
                     user_table.c.id == address_table.c.user_id)
            stmt = select(user_table).select_from(j)

        would emit SQL along the lines of::

            SELECT user.id, user.name FROM user
            JOIN address ON user.id = address.user_id

        Similar functionality is available given any
        :class:`_expression.FromClause` object (e.g. such as a
        :class:`_schema.Table`) using
        the :meth:`_expression.FromClause.join` method.

        :param left: The left side of the join.

        :param right: the right side of the join; this is any
         :class:`_expression.FromClause` object such as a
         :class:`_schema.Table` object, and
         may also be a selectable-compatible object such as an ORM-mapped
         class.

        :param onclause: a SQL expression representing the ON clause of the
         join.  If left at ``None``, :meth:`_expression.FromClause.join`
         will attempt to
         join the two tables based on a foreign key relationship.

        :param isouter: if True, render a LEFT OUTER JOIN, instead of JOIN.

        :param full: if True, render a FULL OUTER JOIN, instead of JOIN.

         .. versionadded:: 1.1

        .. seealso::

            :meth:`_expression.FromClause.join` - method form,
            based on a given left side.

            :class:`_expression.Join` - the type of object produced.

        ((R�R�R�R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_joins4cCs2d|jjt|j�|jjt|j�fS(Ns Join object on %s(%d) and %s(%d)(R�R�tidR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Ms
		cCs:t|�t|�kp9|jj|�p9|jj|�S(N(thashR�R�R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�VscCs
t|�S(N(tFromGrouping(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�_sssqlalchemy.sql.utilcCs�tjj}g|jjD]}|^qg|jjD]}|^q5}|jj|jd�|D�|j	��|j
jd�|D��|jj
tjg|D]}|j^q���dS(Ncss|]}|jr|VqdS(N(R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>kscss|]}|j|fVqdS(N(t
_tq_key_label(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>os(R+RORPR�R�R�R�textendtreduce_columnsR�R�R�R�tupdatet	itertoolstchain(R/tsqlutilR�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�bs 			cs�ttjt|j�t|j���}��fd�|D���fd�}|�d<tt|�jd���|j	�dS(Ncs"i|]}�|��|�qS(((R�tf(tcloneRe(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys
<dictcomp>�s	cs<t|t�r8|j�kr8�|jj|�}|SdS(N(t
isinstanceR#ttableRU(tobjRetnewelem(t	new_froms(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytreplace�sR�R�(
R�R�R�RR�R�tsuperR�t_copy_internalst_reset_memoizations(R/R�Ret
all_the_fromsR�((R�ReR�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�us
cCs:tt|�j|�|jj|�|jj|�dS(N(R�R�RIR�R�(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRI�scCs7t|t�r|j}nd}|j||d|�S(Nta_subset(R�R�R�RYt_join_condition(R/R�R�t
left_right((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��sc
Cs�|j||||�}t|�dkrC|j||||�nt|�dkr�t|t�rmd}nd}tjd|j|j|f��ngt|j	��dD]\}}||k^q�}	t|	�dkr�|	dSt
|	�SdS(s=Create a join condition between two tables or selectables.

        e.g.::

            join_condition(tablea, tableb)

        would produce an expression along the lines of::

            tablea.c.id==tableb.c.tablea_id

        The join is determined based on the foreign key relationships
        between the two selectables.   If there are multiple ways
        to join, or no way to join, an error is raised.

        :param a_subset: An optional expression that is a sub-component
         of ``a``.  An attempt will be made to join to just this sub-component
         first before looking at the full ``a`` construct, and if found
         will be successful even if there are other ways to join to ``a``.
         This allows the "right side" of a join to be passed thereby
         providing a "natural join".

        iisI Perhaps you meant to convert the right side to a subquery using alias()?R�sACan't find any foreign key relationships between '%s' and '%s'.%sN(t_joincond_scan_left_righttlent_joincond_trim_constraintsR�R�R*tNoForeignKeysErrorR�tlisttvaluesR(
R�tatbR�tconsider_as_foreign_keystconstraintsthinttxtytcrit((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s 	5c	CsOt|t�r|j}nd}|jd|d|d|d|�}t|�S(NR�R�R�R�(R�R�R�RYR�tbool(R�R�R�R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt	_can_join�s		cCs%tjj}tjtj|�}tjtj|�}tjt	�}x�||fD]�}|dkrjqRnx�t|jdd��D]�}|dk	r�|j
|kr�q�ny|j|�}	WnGtjk
r}
d�|j|�D�}|
j|kr��qq�nX|	dk	r�||jj|	|j
f�q�q�W||k	rx�t|jdd��D]�}|dk	r�|j
|kr�q\ny|j|�}	WnGtjk
r�}
d�|j|�D�}|
j|kr\�q�q\nX|	dk	r\||jj|	|j
f�q\q\Wn|rRPqRqRW|S(NR�cSs
|jjS(N(tparentt_creation_order(tfk((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt<lambda>�R�cSsh|]}|j�qS((RL(R�tt((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<setcomp>s	cSs
|jjS(N(R�R�(R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
R�cSsh|]}|j�qS((RL(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<setcomp>s	(R+RORPRRhRR}tcollectionstdefaultdictR�RYtsortedR�R�tget_referentR*tNoReferenceErrortfind_tablest
table_namet
constrainttappend(R�R�R�R�R�RPR�R�R�R�tnrtettable_names((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��sN$'cCs�|rOxFt|�D]5}td�|jD��t|�kr||=qqWnt|�dkr�td�|j�D��}t|�dkr�t|�d}i|||6}q�nt|�dkr�tjd|j|jf��ndS(Ncss|]}|jVqdS(N(R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>,sicss|]}t|�VqdS(N(Rg(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>4sis�Can't determine join between '%s' and '%s'; tables have more than one foreign key constraint relationship between them. Please specify the 'onclause' of this join explicitly.(R�R�telementsR�R�R*tAmbiguousForeignKeysErrorR�(R�R�R�R�R�tconsttdedupeR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�#sR�s2.0s�The :paramref:`_sql.Join.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.R;s�The :meth:`_sql.Join.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.cKsG|j|jg}|dk	r+||d<ntj|||�j|�S(s�Create a :class:`_expression.Select` from this
        :class:`_expression.Join`.

        E.g.::

            stmt = table_a.join(table_b, table_a.c.id == table_b.c.a_id)

            stmt = stmt.select()

        The above will produce a SQL string resembling::

            SELECT table_a.id, table_a.col, table_b.id, table_b.a_id
            FROM table_a JOIN table_b ON table_a.id = table_b.a_id

        :param whereclause: WHERE criteria, same as calling
          :meth:`_sql.Select.where` on the resulting statement

        :param \**kwargs: additional keyword arguments are passed to the
         legacy constructor for :class:`_sql.Select` described at
         :meth:`_sql.Select.create_legacy_select`.

        R�N(R�R�RYR6R�tselect_from(R/R�R;tcollist((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Bs)
s:attr:`.Executable.bind`talternatives5Bound metadata is being removed as of SQLAlchemy 2.0.tenable_warningscCs|jjp|jjS(ssReturn the bound engine associated with either the left or right
        side of this :class:`_sql.Join`.

        (R�tbindR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRsscCs�tjj}|r�|dk	r0tjd��n|jjdt�|j	jdt�}}|j
|�j|j
|��}|j||j
|j�d|jd|j�S|j�jt�jd�j|�SdS(Ns"Can't send name argument with flatR�R�R�(R+RORPRYR*RbR�R�R3R�RQR�RcRRR�R�R�R�tset_label_styleR�t	correlateR9(R/RLR�R�tleft_atright_atadapter((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s"	
		s:meth:`_sql.Join.alias`sTCreate a select + subquery, or alias the individual tables inside the join, instead.cCs|jd|d|�S(s@Return an alias of this :class:`_expression.Join`.

        The default behavior here is to first produce a SELECT
        construct from this :class:`_expression.Join`, then to produce an
        :class:`_expression.Alias` from that.  So given a join of the form::

            j = table_a.join(table_b, table_a.c.id == table_b.c.a_id)

        The JOIN by itself would look like::

            table_a JOIN table_b ON table_a.id = table_b.a_id

        Whereas the alias of the above, ``j.alias()``, would in a
        SELECT context look like::

            (SELECT table_a.id AS table_a_id, table_b.id AS table_b_id,
                table_b.a_id AS table_b_a_id
                FROM table_a
                JOIN table_b ON table_a.id = table_b.a_id) AS anon_1

        The equivalent long-hand form, given a :class:`_expression.Join`
        object ``j``, is::

            from sqlalchemy import select, alias
            j = alias(
                select(j.left, j.right).\
                    select_from(j).\
                    set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL).\
                    correlate(False),
                name=name
            )

        The selectable produced by :meth:`_expression.Join.alias`
        features the same
        columns as that of the two individual selectables presented under
        a single name - the individual columns are "auto-labeled", meaning
        the ``.c.`` collection of the resulting :class:`_expression.Alias`
        represents
        the names of the individual columns using a
        ``<tablename>_<columname>`` scheme::

            j.c.table_a_id
            j.c.table_b_a_id

        :meth:`_expression.Join.alias` also features an alternate
        option for aliasing joins which produces no enclosing SELECT and
        does not normally apply labels to the column names.  The
        ``flat=True`` option will call :meth:`_expression.FromClause.alias`
        against the left and right sides individually.
        Using this option, no new ``SELECT`` is produced;
        we instead, from a construct as below::

            j = table_a.join(table_b, table_a.c.id == table_b.c.a_id)
            j = j.alias(flat=True)

        we get a result like this::

            table_a AS table_a_1 JOIN table_b AS table_b_1 ON
            table_a_1.id = table_b_1.a_id

        The ``flat=True`` argument is also propagated to the contained
        selectables, so that a composite join such as::

            j = table_a.join(
                    table_b.join(table_c,
                            table_b.c.id == table_c.c.b_id),
                    table_b.c.a_id == table_a.c.id
                ).alias(flat=True)

        Will produce an expression like::

            table_a AS table_a_1 JOIN (
                    table_b AS table_b_1 JOIN table_c AS table_c_1
                    ON table_b_1.id = table_c_1.b_id
            ) ON table_a_1.id = table_b_1.a_id

        The standalone :func:`_expression.alias` function as well as the
        base :meth:`_expression.FromClause.alias`
        method also support the ``flat=True``
        argument as a no-op, so that the argument can be passed to the
        ``alias()`` method of any selectable.

        :param name: name given to the alias.

        :param flat: if True, produce an alias of the left and right
         sides of this :class:`_expression.Join` and return the join of those
         two selectables.   This produces join expression that does not
         include an enclosing SELECT.

        .. seealso::

            :ref:`core_tutorial_aliases`

            :func:`_expression.alias`

        R�RL(R�(R/RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9�sfcCs2tjg|jD]}t|j|j�^q�S(N(R�R�R�RR�R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scCs|g|jj|jjS(N(R�RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRsN(s2.0s�The :paramref:`_sql.Join.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.(s2.0s�The :meth:`_sql.Join.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.('R1R2RARWR)tdp_clauseelementt
dp_booleant_traverse_internalsR3R�RYRCR�tclassmethodR�R�R5R�R�R�R+R[R�R	R�RIR�R�R�R�R�R�R�t
deprecated_20RR�R9R�R(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s\4			!		59	
ctNoInitcBseZd�ZRS(cOs;td|jj|jjj�|jjj�f��dS(Ns�The %s class is not intended to be constructed directly.  Please use the %s() standalone function or the %s() method available from appropriate selectable objects.(R>R�R1tlower(R/targRe((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s
	(R1R2R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRstAliasedReturnsRowscBs�eZdZeZeZeZdej	fdej
fgZed��Z
edd��Zdd�Zd�Zed��Zed��Zd	�Zd
�Zed�Zed��Zed
��ZRS(sLBase class of aliases against tables, subqueries, and other
    selectables.telementRLcOs#|j|�}|j||�|S(N(t__new__t_init(R�RReR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRK5scCs
t��dS(s6Base factory method.  Subclasses need to provide this.N(R>(R�treturnsrowsRL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_factory;scCs�tjtj|d|�|_||_||_|dkr�t|t�r�|j	r�t
|dd�}t|t�r�d}q�ntjt
|�|p�d�}n||_dS(Ntapply_propagate_attrsRLtanon(RRhRtReturnsRowsRoleRt
_orig_nameRYR�R�R�R�Rtsafe_constructR�RL(R/R=RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR@s			!cCs*tt|�j|�|jj|�dS(N(R�RRIR(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRIQscCsB|j}t|t�r!d}ntjr.|S|jdd�SdS(Ntanon_1tasciitbackslashreplace(RLR�RR+tpy3ktencode(R/RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Us			cCs|jS(s9Legacy for dialects that are referring to Alias.original.(R(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytoriginal`scCs#||jkrtS|jj|�S(N(R�R3RR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�escCs|jj|�dS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�jscKsE|j}tt|�jd||�||jk	rA|j�ndS(NR�(RR�RR�R�(R/R�Retexisting_element((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�ms	cCs|gS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRyscCs
|jjS(N(RR(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR}sN(R1R2RAR3t_is_from_containerR�RCt_supports_derived_columnsR)Rtdp_anon_nameRRRKRYRRRIR5R�R)R�R�R	R�RR(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR's$			R�cBs/eZdZdZeZeded��Z	RS(sRepresents an table or selectable alias (AS).

    Represents an alias, as typically applied to any table or
    sub-select within a SQL statement using the ``AS`` keyword (or
    without the keyword on certain databases such as Oracle).

    This object is constructed from the :func:`_expression.alias` module
    level function as well as the :meth:`_expression.FromClause.alias`
    method available
    on all :class:`_expression.FromClause` subclasses.

    .. seealso::

        :meth:`_expression.FromClause.alias`

    R9cCs+tjtj|dt�jd|d|�S(s�Return an :class:`_expression.Alias` object.

        An :class:`_expression.Alias` represents any
        :class:`_expression.FromClause`
        with an alternate name assigned within SQL, typically using the ``AS``
        clause when generated, e.g. ``SELECT * FROM table AS aliasname``.

        Similar functionality is available via the
        :meth:`_expression.FromClause.alias`
        method available on all :class:`_expression.FromClause` subclasses.
        In terms of
        a SELECT object as generated from the :func:`_expression.select`
        function, the :meth:`_expression.SelectBase.alias` method returns an
        :class:`_expression.Alias` or similar object which represents a named,
        parenthesized subquery.

        When an :class:`_expression.Alias` is created from a
        :class:`_schema.Table` object,
        this has the effect of the table being rendered
        as ``tablename AS aliasname`` in a SELECT statement.

        For :func:`_expression.select` objects, the effect is that of
        creating a named subquery, i.e. ``(select ...) AS aliasname``.

        The ``name`` parameter is optional, and provides the name
        to use in the rendered SQL.  If blank, an "anonymous" name
        will be deterministically generated at compile time.
        Deterministic means the name is guaranteed to be unique against
        other constructs used in the same statement, and will also be the
        same name for each successive compilation of the same statement
        object.

        :param selectable: any :class:`_expression.FromClause` subclass,
            such as a table, select statement, etc.

        :param name: string name to be assigned as the alias.
            If ``None``, a name will be deterministically generated
            at compile time.

        :param flat: Will be passed through to if the given selectable
         is an instance of :class:`_expression.Join` - see
         :meth:`_expression.Join.alias`
         for details.

        tallow_selectRLR�(RRhRR}R3R9(R�R=RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s/N(
R1R2RARWR3R4RRYRCR(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
tTableValuedAliascBs�eZdZdZeZeZeZeZ	de
jfde
jfde
j
fde
jfde
jfgZdded�Zejd��Zdd	�Zdd
�Zded�ZRS(
s�An alias against a "table valued" SQL function.

    This construct provides for a SQL function that returns columns
    to be used in the FROM clause of a SELECT statement.   The
    object is generated using the :meth:`_functions.FunctionElement.table_valued`
    method, e.g.::

        >>> from sqlalchemy import select, func
        >>> fn = func.json_array_elements_text('["one", "two", "three"]').table_valued("value")
        >>> print(select(fn.c.value))
        SELECT anon_1.value
        FROM json_array_elements_text(:json_array_elements_text_1) AS anon_1

    .. versionadded:: 1.4.0b2

    .. seealso::

        :ref:`tutorial_functions_table_valued` - in the :ref:`unified_tutorial`

    ttable_valued_aliasRRLt_tableval_typet_render_derivedt_render_derived_w_typescCsGtt|�j|d|�||_|dkr:tjn||_dS(NRL(R�R/Rtjoins_implicitlyRYRR�R1(R/R=RLttable_value_typeR4((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s	cCst||j�S(s�Return a column expression representing this
        :class:`_sql.TableValuedAlias`.

        This accessor is used to implement the
        :meth:`_functions.FunctionElement.column_valued` method. See that
        method for further details.

        E.g.::

            >>> print(select(func.some_func().table_valued("value").column))
            SELECT anon_1 FROM some_func() AS anon_1

        .. seealso::

            :meth:`_functions.FunctionElement.column_valued`

        (R'R1(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRHscCsLtj|d|d|jd|j�}|jrHt|_|j|_n|S(s�Return a new alias of this :class:`_sql.TableValuedAlias`.

        This creates a distinct FROM object that will be distinguished
        from the original one when used in a SQL statement.

        RLR5R4(R/RKR1R4R2R3R3(R/RLttva((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9s			cCs|jd|�}t|_|S(s�Return a new :class:`_sql.TableValuedAlias` with the lateral flag
        set, so that it renders as LATERAL.

        .. seealso::

            :func:`_expression.lateral`

        RL(R9R3RF(R/RLR6((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRM,s		cCs@tj|jd|d|jd|j�}t|_||_|S(sfApply "render derived" to this :class:`_sql.TableValuedAlias`.

        This has the effect of the individual column names listed out
        after the alias name in the "AS" sequence, e.g.::

            >>> print(
            ...     select(
            ...         func.unnest(array(["one", "two", "three"])).
                        table_valued("x", with_ordinality="o").render_derived()
            ...     )
            ... )
            SELECT anon_1.x, anon_1.o
            FROM unnest(ARRAY[%(param_1)s, %(param_2)s, %(param_3)s]) WITH ORDINALITY AS anon_1(x, o)

        The ``with_types`` keyword will render column types inline within
        the alias expression (this syntax currently applies to the
        PostgreSQL database)::

            >>> print(
            ...     select(
            ...         func.json_to_recordset(
            ...             '[{"a":1,"b":"foo"},{"a":"2","c":"bar"}]'
            ...         )
            ...         .table_valued(column("a", Integer), column("b", String))
            ...         .render_derived(with_types=True)
            ...     )
            ... )
            SELECT anon_1.a, anon_1.b FROM json_to_recordset(:json_to_recordset_1)
            AS anon_1(a INTEGER, b VARCHAR)

        :param name: optional string name that will be applied to the alias
         generated.  If left as None, a unique anonymizing name will be used.

        :param with_types: if True, the derived columns will include the
         datatype specification with each column. This is a special syntax
         currently known to be required by PostgreSQL for some SQL functions.

        RLR5R4(R/RKRR1R4R3R2R3(R/RLt
with_typest	new_alias((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytrender_derived9s0				N(R1R2RARWR3R,RCR2R3R4R)RR-tdp_typeRRRYRRtmemoized_attributeRHR9RMR9(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR/�s$
RJcBs2eZdZdZeZeZedd��Z	RS(s�Represent a LATERAL subquery.

    This object is constructed from the :func:`_expression.lateral` module
    level function as well as the :meth:`_expression.FromClause.lateral`
    method available
    on all :class:`_expression.FromClause` subclasses.

    While LATERAL is part of the SQL standard, currently only more recent
    PostgreSQL versions provide support for this keyword.

    .. versionadded:: 1.1

    .. seealso::

        :ref:`tutorial_lateral_correlation` -  overview of usage.

    RMcCs%tjtj|dt�jd|�S(s�Return a :class:`_expression.Lateral` object.

        :class:`_expression.Lateral` is an :class:`_expression.Alias`
        subclass that represents
        a subquery with the LATERAL keyword applied to it.

        The special behavior of a LATERAL subquery is that it appears in the
        FROM clause of an enclosing SELECT, but may correlate to other
        FROM clauses of that SELECT.   It is a special case of subquery
        only supported by a small number of backends, currently more recent
        PostgreSQL versions.

        .. versionadded:: 1.1

        .. seealso::

            :ref:`tutorial_lateral_correlation` -  overview of usage.


        texplicit_subqueryRL(RRhRR}R3RM(R�R=RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�sN(
R1R2RARWR3RFR4RRYR(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRJtsR�cBsueZdZdZejdejfdejfgZeddd��Z
ejd�ddd��Z
d�ZRS(	sdRepresent a TABLESAMPLE clause.

    This object is constructed from the :func:`_expression.tablesample` module
    level function as well as the :meth:`_expression.FromClause.tablesample`
    method
    available on all :class:`_expression.FromClause` subclasses.

    .. versionadded:: 1.1

    .. seealso::

        :func:`_expression.tablesample`

    R�R�R�cCs(tjtj|�j|d|d|�S(s�Return a :class:`_expression.TableSample` object.

        :class:`_expression.TableSample` is an :class:`_expression.Alias`
        subclass that represents
        a table with the TABLESAMPLE clause applied to it.
        :func:`_expression.tablesample`
        is also available from the :class:`_expression.FromClause`
        class via the
        :meth:`_expression.FromClause.tablesample` method.

        The TABLESAMPLE clause allows selecting a randomly selected approximate
        percentage of rows from a table. It supports multiple sampling methods,
        most commonly BERNOULLI and SYSTEM.

        e.g.::

            from sqlalchemy import func

            selectable = people.tablesample(
                        func.bernoulli(1),
                        name='alias',
                        seed=func.random())
            stmt = select(selectable.c.people_id)

        Assuming ``people`` with a column ``people_id``, the above
        statement would render as::

            SELECT alias.people_id FROM
            people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
            REPEATABLE (random())

        .. versionadded:: 1.1

        :param sampling: a ``float`` percentage between 0 and 100 or
            :class:`_functions.Function`.

        :param name: optional alias name

        :param seed: any real-valued SQL expression.  When specified, the
         REPEATABLE sub-clause is also rendered.

        RLR�(RRhRR}R�(R�R=R�RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s,ssqlalchemy.sql.functionscCsetjj}t||j�s3|jj|�}n||_||_t	t
|�j|d|�dS(NRL(R+ROt
sql_functionsR�tFunctiontfunctsystemR�R�R�R�R(R/R=R�RLR�t	functions((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s		cCs|jS(N(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_get_method�sN(R1R2RARWRRR)RRRYRR+R[RRB(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s/	tCTEcBs�eZdZdZejdejfdejfdejfdejfge	j
ejZe
d
ed��Zd
eed
d
d
d
d�Zd�Zd
ed	�Zd
�Zd�Zd�ZRS(sURepresent a Common Table Expression.

    The :class:`_expression.CTE` object is obtained using the
    :meth:`_sql.SelectBase.cte` method from any SELECT statement. A less often
    available syntax also allows use of the :meth:`_sql.HasCTE.cte` method
    present on :term:`DML` constructs such as :class:`_sql.Insert`,
    :class:`_sql.Update` and
    :class:`_sql.Delete`.   See the :meth:`_sql.HasCTE.cte` method for
    usage details on CTEs.

    .. seealso::

        :ref:`tutorial_subqueries_ctes` - in the 2.0 tutorial

        :meth:`_sql.HasCTE.cte` - examples of calling styles

    tctet
_cte_aliast	_restatest	recursivetnestingcCs%tjtj|�jd|d|�S(s�Return a new :class:`_expression.CTE`,
        or Common Table Expression instance.

        Please see :meth:`_expression.HasCTE.cte` for detail on CTE usage.

        RLRG(RRhRt
HasCTERoleRD(R�R=RLRG((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR$sc		Csh||_||_||_||_|r6||_n|rH||_ntt|�j|d|�dS(NRL(	RGRHRERFR]RoR�RCR(	R/R=RLRGRHRERFR]Ro((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR0s				cCs6|jdk	r"|jj|�n|jj|�dS(N(RERYR�R(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�FscCs@tj|jd|d|jd|jd|d|jd|j�S(s2Return an :class:`_expression.Alias` of this
        :class:`_expression.CTE`.

        This method is a CTE-specific specialization of the
        :meth:`_expression.FromClause.alias` method.

        .. seealso::

            :ref:`tutorial_using_aliases`

            :func:`_expression.alias`

        RLRGRHRER]Ro(RCRKRRGRHR]Ro(R/RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9Ls				cGsLtj|jj|�d|jd|jd|jd|d|jd|j�S(s�Return a new :class:`_expression.CTE` with a SQL ``UNION``
        of the original CTE against the given selectables provided
        as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28 multiple elements are now accepted.

        .. seealso::

            :meth:`_sql.HasCTE.cte` - examples of calling styles

        RLRGRHRFR]Ro(	RCRKRR|RLRGRHR]Ro(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR|ds				cGsLtj|jj|�d|jd|jd|jd|d|jd|j�S(s�Return a new :class:`_expression.CTE` with a SQL ``UNION ALL``
        of the original CTE against the given selectables provided
        as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28 multiple elements are now accepted.

        .. seealso::

            :meth:`_sql.HasCTE.cte` - examples of calling styles

        RLRGRHRFR]Ro(	RCRKRt	union_allRLRGRHR]Ro(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRJ}s				cCs|jdk	r|jS|S(s�
        A recursive CTE is updated to attach the recursive part.
        Updated CTEs should still refer to the original CTE.
        This function returns this reference identifier.
        N(RFRY(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_get_reference_cte�sN(R1R2RARWRRR)RRR\RmRnRsRRYRCRRR�R9R|RJRK(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRC�s"K
			tHasCTEcBsGeZdZdejfgZdZed��Zde
e
d�ZRS(sTMixin that declares a class to include CTE support.

    .. versionadded:: 1.1

    t_independent_ctescCs+tjtj|�}|j|f7_dS(sdAdd a :class:`_sql.CTE` to this statement object that will be
        independently rendered even if not referenced in the statement
        otherwise.

        This feature is useful for the use case of embedding a DML statement
        such as an INSERT or UPDATE as a CTE inline with a primary statement
        that may draw from its results indirectly; while PostgreSQL is known
        to support this usage, it may not be supported by other backends.

        E.g.::

            from sqlalchemy import table, column, select
            t = table('t', column('c1'), column('c2'))

            ins = t.insert().values({"c1": "x", "c2": "y"}).cte()

            stmt = select(t).add_cte(ins)

        Would render::

            WITH anon_1 AS
            (INSERT INTO t (c1, c2) VALUES (:param_1, :param_2))
            SELECT t.c1, t.c2
            FROM t

        Above, the "anon_1" CTE is not referred towards in the SELECT
        statement, however still accomplishes the task of running an INSERT
        statement.

        Similarly in a DML-related context, using the PostgreSQL
        :class:`_postgresql.Insert` construct to generate an "upsert"::

            from sqlalchemy import table, column
            from sqlalchemy.dialects.postgresql import insert

            t = table("t", column("c1"), column("c2"))

            delete_statement_cte = (
                t.delete().where(t.c.c1 < 1).cte("deletions")
            )

            insert_stmt = insert(t).values({"c1": 1, "c2": 2})
            update_statement = insert_stmt.on_conflict_do_update(
                index_elements=[t.c.c1],
                set_={
                    "c1": insert_stmt.excluded.c1,
                    "c2": insert_stmt.excluded.c2,
                },
            ).add_cte(delete_statement_cte)

            print(update_statement)

        The above statement renders as::

            WITH deletions AS
            (DELETE FROM t WHERE t.c1 < %(c1_1)s)
            INSERT INTO t (c1, c2) VALUES (%(c1)s, %(c2)s)
            ON CONFLICT (c1) DO UPDATE SET c1 = excluded.c1, c2 = excluded.c2

        .. versionadded:: 1.4.21

        N(RRhRt	IsCTERoleRM(R/RD((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytadd_cte�s@cCstj|d|d|d|�S(sK"Return a new :class:`_expression.CTE`,
        or Common Table Expression instance.

        Common table expressions are a SQL standard whereby SELECT
        statements can draw upon secondary statements specified along
        with the primary statement, using a clause called "WITH".
        Special semantics regarding UNION can also be employed to
        allow "recursive" queries, where a SELECT statement can draw
        upon the set of rows that have previously been selected.

        CTEs can also be applied to DML constructs UPDATE, INSERT
        and DELETE on some databases, both as a source of CTE rows
        when combined with RETURNING, as well as a consumer of
        CTE rows.

        .. versionchanged:: 1.1 Added support for UPDATE/INSERT/DELETE as
           CTE, CTEs added to UPDATE/INSERT/DELETE.

        SQLAlchemy detects :class:`_expression.CTE` objects, which are treated
        similarly to :class:`_expression.Alias` objects, as special elements
        to be delivered to the FROM clause of the statement as well
        as to a WITH clause at the top of the statement.

        For special prefixes such as PostgreSQL "MATERIALIZED" and
        "NOT MATERIALIZED", the :meth:`_expression.CTE.prefix_with`
        method may be
        used to establish these.

        .. versionchanged:: 1.3.13 Added support for prefixes.
           In particular - MATERIALIZED and NOT MATERIALIZED.

        :param name: name given to the common table expression.  Like
         :meth:`_expression.FromClause.alias`, the name can be left as
         ``None`` in which case an anonymous symbol will be used at query
         compile time.
        :param recursive: if ``True``, will render ``WITH RECURSIVE``.
         A recursive common table expression is intended to be used in
         conjunction with UNION ALL in order to derive rows
         from those already selected.
        :param nesting: if ``True``, will render the CTE locally to the
         actual statement.

         .. versionadded:: 1.4.24

        The following examples include two from PostgreSQL's documentation at
        https://www.postgresql.org/docs/current/static/queries-with.html,
        as well as additional examples.

        Example 1, non recursive::

            from sqlalchemy import (Table, Column, String, Integer,
                                    MetaData, select, func)

            metadata = MetaData()

            orders = Table('orders', metadata,
                Column('region', String),
                Column('amount', Integer),
                Column('product', String),
                Column('quantity', Integer)
            )

            regional_sales = select(
                                orders.c.region,
                                func.sum(orders.c.amount).label('total_sales')
                            ).group_by(orders.c.region).cte("regional_sales")


            top_regions = select(regional_sales.c.region).\
                    where(
                        regional_sales.c.total_sales >
                        select(
                            func.sum(regional_sales.c.total_sales) / 10
                        )
                    ).cte("top_regions")

            statement = select(
                        orders.c.region,
                        orders.c.product,
                        func.sum(orders.c.quantity).label("product_units"),
                        func.sum(orders.c.amount).label("product_sales")
                ).where(orders.c.region.in_(
                    select(top_regions.c.region)
                )).group_by(orders.c.region, orders.c.product)

            result = conn.execute(statement).fetchall()

        Example 2, WITH RECURSIVE::

            from sqlalchemy import (Table, Column, String, Integer,
                                    MetaData, select, func)

            metadata = MetaData()

            parts = Table('parts', metadata,
                Column('part', String),
                Column('sub_part', String),
                Column('quantity', Integer),
            )

            included_parts = select(\
                parts.c.sub_part, parts.c.part, parts.c.quantity\
                ).\
                where(parts.c.part=='our part').\
                cte(recursive=True)


            incl_alias = included_parts.alias()
            parts_alias = parts.alias()
            included_parts = included_parts.union_all(
                select(
                    parts_alias.c.sub_part,
                    parts_alias.c.part,
                    parts_alias.c.quantity
                ).\
                where(parts_alias.c.part==incl_alias.c.sub_part)
            )

            statement = select(
                        included_parts.c.sub_part,
                        func.sum(included_parts.c.quantity).
                          label('total_quantity')
                    ).\
                    group_by(included_parts.c.sub_part)

            result = conn.execute(statement).fetchall()

        Example 3, an upsert using UPDATE and INSERT with CTEs::

            from datetime import date
            from sqlalchemy import (MetaData, Table, Column, Integer,
                                    Date, select, literal, and_, exists)

            metadata = MetaData()

            visitors = Table('visitors', metadata,
                Column('product_id', Integer, primary_key=True),
                Column('date', Date, primary_key=True),
                Column('count', Integer),
            )

            # add 5 visitors for the product_id == 1
            product_id = 1
            day = date.today()
            count = 5

            update_cte = (
                visitors.update()
                .where(and_(visitors.c.product_id == product_id,
                            visitors.c.date == day))
                .values(count=visitors.c.count + count)
                .returning(literal(1))
                .cte('update_cte')
            )

            upsert = visitors.insert().from_select(
                [visitors.c.product_id, visitors.c.date, visitors.c.count],
                select(literal(product_id), literal(day), literal(count))
                    .where(~exists(update_cte.select()))
            )

            connection.execute(upsert)

        Example 4, Nesting CTE (SQLAlchemy 1.4.24 and above)::

            value_a = select(
                literal("root").label("n")
            ).cte("value_a")

            # A nested CTE with the same name as the root one
            value_a_nested = select(
                literal("nesting").label("n")
            ).cte("value_a", nesting=True)

            # Nesting CTEs takes ascendency locally
            # over the CTEs at a higher level
            value_b = select(value_a_nested.c.n).cte("value_b")

            value_ab = select(value_a.c.n.label("a"), value_b.c.n.label("b"))

        The above query will render the second CTE nested inside the first,
        shown with inline parameters below as::

            WITH
                value_a AS
                    (SELECT 'root' AS n),
                value_b AS
                    (WITH value_a AS
                        (SELECT 'nesting' AS n)
                    SELECT value_a.n AS n FROM value_a)
            SELECT value_a.n AS a, value_b.n AS b
            FROM value_a, value_b

        Example 5, Non-Linear CTE (SQLAlchemy 1.4.28 and above)::

            edge = Table(
                "edge",
                metadata,
                Column("id", Integer, primary_key=True),
                Column("left", Integer),
                Column("right", Integer),
            )

            root_node = select(literal(1).label("node")).cte(
                "nodes", recursive=True
            )

            left_edge = select(edge.c.left).join(
                root_node, edge.c.right == root_node.c.node
            )
            right_edge = select(edge.c.right).join(
                root_node, edge.c.left == root_node.c.node
            )

            subgraph_cte = root_node.union(left_edge, right_edge)

            subgraph = select(subgraph_cte)

        The above query will render 2 UNIONs inside the recursive CTE::

            WITH RECURSIVE nodes(node) AS (
                    SELECT 1 AS node
                UNION
                    SELECT edge."left" AS "left"
                    FROM edge JOIN nodes ON edge."right" = nodes.node
                UNION
                    SELECT edge."right" AS "right"
                    FROM edge JOIN nodes ON edge."left" = nodes.node
            )
            SELECT nodes.node FROM nodes

        .. seealso::

            :meth:`_orm.Query.cte` - ORM version of
            :meth:`_expression.HasCTE.cte`.

        RLRGRH(RCRK(R/RLRGRH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRD�s�(N(R1R2RAR)tdp_clauseelement_listt_has_ctes_traverse_internalsRMRRORYRCRD(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRL�s
CtSubquerycBsVeZdZdZeZeZedd��Z	e
jdd�d��Zd�Z
RS(s�Represent a subquery of a SELECT.

    A :class:`.Subquery` is created by invoking the
    :meth:`_expression.SelectBase.subquery` method, or for convenience the
    :meth:`_expression.SelectBase.alias` method, on any
    :class:`_expression.SelectBase` subclass
    which includes :class:`_expression.Select`,
    :class:`_expression.CompoundSelect`, and
    :class:`_expression.TextualSelect`.  As rendered in a FROM clause,
    it represents the
    body of the SELECT statement inside of parenthesis, followed by the usual
    "AS <somename>" that defines all "alias" objects.

    The :class:`.Subquery` object is very similar to the
    :class:`_expression.Alias`
    object and can be used in an equivalent way.    The difference between
    :class:`_expression.Alias` and :class:`.Subquery` is that
    :class:`_expression.Alias` always
    contains a :class:`_expression.FromClause` object whereas
    :class:`.Subquery`
    always contains a :class:`_expression.SelectBase` object.

    .. versionadded:: 1.4 The :class:`.Subquery` class was added which now
       serves the purpose of providing an aliased version of a SELECT
       statement.

    R8cCstjtj|�jd|�S(s#Return a :class:`.Subquery` object.RL(RRhRtSelectStatementRoleR8(R�R=RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR
ss1.4sxThe :meth:`.Subquery.as_scalar` method, which was previously ``Alias.as_scalar()`` prior to version 1.4, is deprecated and will be removed in a future release; Please use the :meth:`_expression.Select.scalar_subquery` method of the :func:`_expression.select` construct before constructing a subquery object, or with the ORM use the :meth:`_query.Query.scalar_subquery` method.cCs|jjt�j�S(N(RRR�tscalar_subquery(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt	as_scalar
scCs/tjdd�|jj||||dt�S(Ns�Executing a subquery object is deprecated and will raise ObjectNotExecutableError in an upcoming release.  Please execute the underlying select() statement directly.s1.4t_force(R+twarn_deprecatedRt_execute_on_connectionR3(R/t
connectiontmultiparamstparamstexecution_options((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRX
s
	N(R1R2RARWR3t_is_subqueryR4RRYRR+RZRURX(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRR�	sR�cBs�eZdZdejfgZd�Zd�Zed��Z	ed��Z
ed��Zd�Zd�Z
d	�Zed
��Zed��Zd�Zd
�ZRS(s%Represent a grouping of a FROM clauseRcCstjtj|�|_dS(N(RRhRR}R(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�0
scCsdS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�3
scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�6
scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�:
scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�>
scCs|jj|�S(N(RR�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�B
scKst|jj|��S(N(R�RR9(R/Re((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9E
scKst|jj|��S(N(R�RR�(R/Re((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�H
scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�K
scCs
|jjS(N(RR(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRO
scCsi|jd6S(NR(R(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__getstate__S
scCs|d|_dS(NR(R(R/tstate((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__setstate__V
s(R1R2RAR)RRR�R�R5R�R�R�R�R9R�R�RR^R`(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�+
s						tTableClausecBs�eZdZdZdejfdejfdejfgZeZ	e
ZdZ
d�Zd�Zd�Zd�Zejd	��Zd
�Zejd�de
d��Zejd�dde
d
��Zejd�dd��Zed��ZRS(s-Represents a minimal "table" construct.

    This is a lightweight table object that has only a name, a
    collection of columns, which are typically produced
    by the :func:`_expression.column` function, and a schema::

        from sqlalchemy import table, column

        user = table("user",
                column("id"),
                column("name"),
                column("description"),
        )

    The :class:`_expression.TableClause` construct serves as the base for
    the more commonly used :class:`_schema.Table` object, providing
    the usual set of :class:`_expression.FromClause` services including
    the ``.c.`` collection and statement generation methods.

    It does **not** provide all the additional schema-level services
    of :class:`_schema.Table`, including constraints, references to other
    tables, or support for :class:`_schema.MetaData`-level services.
    It's useful
    on its own as an ad-hoc construct used to generate quick SQL
    statements when a more fully fledged :class:`_schema.Table`
    is not on hand.

    R�R�RLR�cOs�tt|�j�||_t�|_t�|_t�|_	x|D]}|j
|�qGW|jdd�}|dk	r�||_
n|j
dk	r�d|j
|jf|_n|j|_|r�tjdt|���ndS(sProduce a new :class:`_expression.TableClause`.

        The object returned is an instance of
        :class:`_expression.TableClause`, which
        represents the "syntactical" portion of the schema-level
        :class:`_schema.Table` object.
        It may be used to construct lightweight table constructs.

        .. versionchanged:: 1.0.0 :func:`_expression.table` can now
           be imported from the plain ``sqlalchemy`` namespace like any
           other SQL element.


        :param name: Name of the table.

        :param columns: A collection of :func:`_expression.column` constructs.

        :param schema: The schema name for this table.

            .. versionadded:: 1.3.18 :func:`_expression.table` can now
               accept a ``schema`` argument.
        R�s%s.%ssUnsupported argument(s): %sN(R�RaR�RLRR�RR�R�R�t
append_columnRaRYR�tfullnameR*RbR�(R/RLR�ReR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
s	
cCs,|jdk	r!|jd|jS|jSdS(Nt.(R�RYRL(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__str__�
scCsdS(N((R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRI�
scCsdS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
scCs'tjr|jS|jjdd�SdS(NR%R&(R+R'RLR((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
s	cKs]|j}|dk	r@||k	r@tjd|j|f��n|jj|�||_dS(Ns1column object '%s' already assigned to table '%s'(R�RYR*RbR�R�tadd(R/R�Retexisting((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRb�
s	ssqlalchemy.sql.dmlcKs"tjjj|d|d||�S(s�Generate an :func:`_expression.insert` construct against this
        :class:`_expression.TableClause`.

        E.g.::

            table.insert().values(name='foo')

        See :func:`_expression.insert` for argument and usage information.

        R�tinline(R+ROtsql_dmltInsert(R/R�RhR;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytinsert�
sc	Ks(tjjj|d|d|d||�S(sGenerate an :func:`_expression.update` construct against this
        :class:`_expression.TableClause`.

        E.g.::

            table.update().where(table.c.id==7).values(name='foo')

        See :func:`_expression.update` for argument and usage information.

        R�R�Rh(R+RORitUpdate(R/R�R�RhR;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
scKstjjj|||�S(s�Generate a :func:`_expression.delete` construct against this
        :class:`_expression.TableClause`.

        E.g.::

            table.delete().where(table.c.id==7)

        See :func:`_expression.delete` for argument and usage information.

        (R+RORitDelete(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytdelete�
scCs|gS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRsN(R1R2RARWR)t)dp_fromclause_canonical_column_collectiont	dp_stringRR3R�RCtimplicit_returningRYt_autoincrement_columnR�ReRIR�R+R�R�RbR[RkR�RnR5R(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRaZ
s,		*				
tForUpdateArgcBs�eZdejfdejfdejfdejfgZed��Zd�Zd�Z	d�Z
eed	eed�Z
RS(
toftnowaittreadtskip_lockedcCsJt|t�r|S|dtfkr)dS|tkr<t�St|�SdS(N(R�RsRYRCR3(R�twith_for_update((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_from_argumentscCsgt|t�of|j|jkof|j|jkof|j|jkof|j|jkof|j|jkS(N(R�RsRuRvRwt	key_shareRt(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__eq__scCs|j|�S(N(R{(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__ne__)scCs
t|�S(N(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt__hash__,scCst||_||_||_||_|dk	rggtj|�D]}tjt	j
|�^q@|_n	d|_dS(sZRepresents arguments specified to
        :meth:`_expression.Select.for_update`.

        N(RuRvRwRzRYR+tto_listRRhRtColumnsClauseRoleRt(R/RuRvRtRwRztelem((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�/s
				4N(R1R2R)RPRRRRyR{R|R}RCRYR�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRss	
		tValuescBs�eZdZeZdZd
Zdejfdej	fdej
fdejfgZd�Z
ed��Zed��Zedd	��Zed
��Zd�Zed��ZRS(s�Represent a ``VALUES`` construct that can be used as a FROM element
    in a statement.

    The :class:`_expression.Values` object is created from the
    :func:`_expression.values` function.

    .. versionadded:: 1.4

    R�t_column_argst_dataRLt
literal_bindscOs\tt|�j�||_|jdd�|_|jdt�|_|jdk	|_	dS(sConstruct a :class:`_expression.Values` construct.

        The column expressions and the actual data for
        :class:`_expression.Values` are given in two separate steps.  The
        constructor receives the column expressions typically as
        :func:`_expression.column` constructs,
        and the data is then passed via the
        :meth:`_expression.Values.data` method as a list,
        which can be called multiple
        times to add more data, e.g.::

            from sqlalchemy import column
            from sqlalchemy import values

            value_expr = values(
                column('id', Integer),
                column('name', String),
                name="my_values"
            ).data(
                [(1, 'name1'), (2, 'name2'), (3, 'name3')]
            )

        :param \*columns: column expressions, typically composed using
         :func:`_expression.column` objects.

        :param name: the name for this VALUES construct.  If omitted, the
         VALUES construct will be unnamed in a SQL expression.   Different
         backends may have different requirements here.

        :param literal_binds: Defaults to False.  Whether or not to render
         the data values inline in the SQL output, rather than using bound
         parameters.

        RLR�N(
R�R�R�R�RaRYRLRCR�R�(R/R�Re((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�`s
$	cCsg|jD]}|j^q
S(N(R�ttype(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
_column_types�scKs||_|jdk	|_dS(sYReturn a new :class:`_expression.Values`
        construct that is a copy of this
        one with the given name.

        This method is a VALUES-specific specialization of the
        :meth:`_expression.FromClause.alias` method.

        .. seealso::

            :ref:`tutorial_using_aliases`

            :func:`_expression.alias`

        N(RLRYR�(R/RLRe((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9�s	cCs%t|_|dk	r!||_ndS(s�Return a new :class:`_expression.Values` with the lateral flag set,
        so that
        it renders as LATERAL.

        .. seealso::

            :func:`_expression.lateral`

        N(R3RFRYRL(R/RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRM�s	cCs|j|f7_dS(srReturn a new :class:`_expression.Values` construct,
        adding the given data
        to the data list.

        E.g.::

            my_values = my_values.data([(1, 'value 1'), (2, 'value2')])

        :param values: a sequence (i.e. list) of tuples that map to the
         column expressions given in the :class:`_expression.Values`
         constructor.

        N(R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytdata�scCs1x*|jD]}|jj|�||_q
WdS(N(R�R�RfR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs|gS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s(N(R1R2RAR3R�RWR�R)RPtdp_dml_multi_valuesRpRRR�R5R�RR9RYRMR�R�R(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Is 		*	t
SelectBasecBs+eZdZeZeZd�Zd�Zed��Z	ed��Z
ed��Zeej
dd�d���Zed	��Zej
dd
�d��Zejd��Zej
dd
�d��Zd�Zd�Zd�Zdd�Zed��Zdd�Zd�Zded�ZRS(s�Base class for SELECT statements.


    This includes :class:`_expression.Select`,
    :class:`_expression.CompoundSelect` and
    :class:`_expression.TextualSelect`.


    cCs
t��dS(N(R>(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs|j�dS(N(R�(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRI�scCs
t��dS(s$A :class:`_expression.ColumnCollection`
        representing the columns that
        this SELECT statement or similar construct returns in its result set.

        This collection differs from the :attr:`_expression.FromClause.columns`
        collection of a :class:`_expression.FromClause` in that the columns
        within this collection cannot be directly nested inside another SELECT
        statement; a subquery must be applied first which provides for the
        necessary parenthesization required by SQL.

        .. note::

            The :attr:`_sql.SelectBase.selected_columns` collection does not
            include expressions established in the columns clause using the
            :func:`_sql.text` construct; these are silently omitted from the
            collection. To use plain textual column expressions inside of a
            :class:`_sql.Select` construct, use the :func:`_sql.literal_column`
            construct.

        .. seealso::

            :attr:`_sql.Select.selected_columns`

        .. versionadded:: 1.4

        N(R>(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytselected_columns�scCs
t��dS(sA sequence of expressions that correspond to what is rendered
        in the columns clause, including :class:`_sql.TextClause`
        constructs.

        .. versionadded:: 1.4.12

        .. seealso::

            :attr:`_sql.SelectBase.exported_columns`

        N(R>(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR?s
cCs|jS(sfA :class:`_expression.ColumnCollection`
        that represents the "exported"
        columns of this :class:`_expression.Selectable`, not including
        :class:`_sql.TextClause` constructs.

        The "exported" columns for a :class:`_expression.SelectBase`
        object are synonymous
        with the :attr:`_expression.SelectBase.selected_columns` collection.

        .. versionadded:: 1.4

        .. seealso::

            :attr:`_expression.Select.exported_columns`

            :attr:`_expression.Selectable.exported_columns`

            :attr:`_expression.FromClause.exported_columns`


        (R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR@ss1.4s�The :attr:`_expression.SelectBase.c` and :attr:`_expression.SelectBase.columns` attributes are deprecated and will be removed in a future release; these attributes implicitly create a subquery that should be explicit.  Please call :meth:`_expression.SelectBase.subquery` first in order to create a subquery, which then contains this attribute.  To access the columns that this SELECT object SELECTs from, use the :attr:`_expression.SelectBase.selected_columns` attribute.cCs
|jjS(N(t_implicit_subqueryR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�/scCs|jS(N(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�@ss The :meth:`_expression.SelectBase.select` method is deprecated and will be removed in a future release; this method implicitly creates a subquery that should be explicit.  Please call :meth:`_expression.SelectBase.subquery` first in order to create a subquery, which then can be selected.cOs|jj||�S(N(R�R�(R/RRe((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Ds
cCs
|j�S(N(R8(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Pss�The :meth:`_expression.SelectBase.as_scalar` method is deprecated and will be removed in a future release.  Please refer to :meth:`_expression.SelectBase.scalar_subquery`.cCs
|j�S(N(RT(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRUTscCs
t|�S(saReturn an :class:`_sql.Exists` representation of this selectable,
        which can be used as a column expression.

        The returned object is an instance of :class:`_sql.Exists`.

        .. seealso::

            :func:`_sql.exists`

            :ref:`tutorial_exists` - in the :term:`2.0 style` tutorial.

        .. versionadded:: 1.4

        (tExists(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytexists^scCs+|jtk	r!|jt�}nt|�S(sXReturn a 'scalar' representation of this selectable, which can be
        used as a column expression.

        The returned object is an instance of :class:`_sql.ScalarSelect`.

        Typically, a select statement which has only one column in its columns
        clause is eligible to be used as a scalar expression.  The scalar
        subquery can then be used in the WHERE clause or columns clause of
        an enclosing SELECT.

        Note that the scalar subquery differentiates from the FROM-level
        subquery that can be produced using the
        :meth:`_expression.SelectBase.subquery`
        method.

        .. versionchanged: 1.4 - the ``.as_scalar()`` method was renamed to
           :meth:`_expression.SelectBase.scalar_subquery`.

        .. seealso::

            :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial

        (t_label_styleR�RtScalarSelect(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRToscCs|j�j|�S(s�Return a 'scalar' representation of this selectable, embedded as a
        subquery with a label.

        .. seealso::

            :meth:`_expression.SelectBase.as_scalar`.

        (RTtlabel(R/RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s	cCstj||�S(sZReturn a LATERAL alias of this :class:`_expression.Selectable`.

        The return value is the :class:`_expression.Lateral` construct also
        provided by the top-level :func:`_expression.lateral` function.

        .. versionadded:: 1.1

        .. seealso::

            :ref:`tutorial_lateral_correlation` -  overview of usage.

        (RJR(R/RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRM�s
cCs|gS(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scCstj|j�|�S(s�Return a subquery of this :class:`_expression.SelectBase`.

        A subquery is from a SQL perspective a parenthesized, named
        construct that can be placed in the FROM clause of another
        SELECT statement.

        Given a SELECT statement such as::

            stmt = select(table.c.id, table.c.name)

        The above statement might look like::

            SELECT table.id, table.name FROM table

        The subquery form by itself renders the same way, however when
        embedded into the FROM clause of another SELECT statement, it becomes
        a named sub-element::

            subq = stmt.subquery()
            new_stmt = select(subq)

        The above renders as::

            SELECT anon_1.id, anon_1.name
            FROM (SELECT table.id, table.name FROM table) AS anon_1

        Historically, :meth:`_expression.SelectBase.subquery`
        is equivalent to calling
        the :meth:`_expression.FromClause.alias`
        method on a FROM object; however,
        as a :class:`_expression.SelectBase`
        object is not directly  FROM object,
        the :meth:`_expression.SelectBase.subquery`
        method provides clearer semantics.

        .. versionadded:: 1.4

        (RRRKt_ensure_disambiguated_names(R/RL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR8�s(cCs
t��dS(stEnsure that the names generated by this selectbase will be
        disambiguated in some way, if possible.

        N(R>(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs|jd|�S(s.Return a named subquery against this
        :class:`_expression.SelectBase`.

        For a :class:`_expression.SelectBase` (as opposed to a
        :class:`_expression.FromClause`),
        this returns a :class:`.Subquery` object which behaves mostly the
        same as the :class:`_expression.Alias` object that is used with a
        :class:`_expression.FromClause`.

        .. versionchanged:: 1.4 The :meth:`_expression.SelectBase.alias`
           method is now
           a synonym for the :meth:`_expression.SelectBase.subquery` method.

        RL(R8(R/RLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR9�sN(R1R2RAR3REt	is_selectR�RIR5R�R?R@R+RZR�R�R�RR;R�RUR�RTR�RYRMRR8R�RCR9(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s8		
			*	tSelectStatementGroupingcBs�eZdZdZdejfgZeZd�Z	d�Z
d�Zd�Ze
d��Ze
d��Zdd	�Zd
�Zd�Zd�Ze
d
��Ze
d��Ze
d��ZRS(s�Represent a grouping of a :class:`_expression.SelectBase`.

    This differs from :class:`.Subquery` in that we are still
    an "inner" SELECT statement, this is strictly for grouping inside of
    compound selects.

    tselect_statement_groupingRcCstjtj|�|_dS(N(RRhRRSR(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs0|jj�}||jk	r(t|�S|SdS(N(RR�R�(R/tnew_element((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
cCs|jS(N(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytget_label_style
scCst|jj|��S(N(R�RR(R/tlabel_style((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR	
scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
scCs|jS(N(R(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytselect_statement
scCs|S(N((R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
scCs|jj|�S(N(Rt_generate_columns_plus_names(R/tanon_for_dupe_key((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
scCs|jj|�dS(N(RR�(R/R8((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
scCs|jj|�S(N(Rt_generate_proxy_for_new_column(R/RHR8((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
scCs
|jjS(N(RR?(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR?"
scCs
|jjS(s:A :class:`_expression.ColumnCollection`
        representing the columns that
        the embedded SELECT statement returns in its result set, not including
        :class:`_sql.TextClause` constructs.

        .. versionadded:: 1.4

        .. seealso::

            :attr:`_sql.Select.selected_columns`

        (RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�&
scCs
|jjS(N(RR(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR6
sN(R1R2RARWR)RRR3t_is_select_containerR�R�R�RR5R�R�RYR�R�R�R�R?R�R(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s"							tDeprecatedSelectBaseGenerationscBsDeZdZejdd�d��Zejdd�d��ZRS(s�A collection of methods available on :class:`_sql.Select` and
    :class:`_sql.CompoundSelect`, these are all **deprecated** methods as they
    modify the object in-place.

    s1.4s�The :meth:`_expression.GenerativeSelect.append_order_by` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.GenerativeSelect.order_by`.cGs|jj||�dS(s�Append the given ORDER BY criterion applied to this selectable.

        The criterion will be appended to any pre-existing ORDER BY criterion.

        This is an **in-place** mutation method; the
        :meth:`_expression.GenerativeSelect.order_by` method is preferred,
        as it
        provides standard :term:`method chaining`.

        .. seealso::

            :meth:`_expression.GenerativeSelect.order_by`

        N(torder_bytnon_generative(R/tclauses((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytappend_order_byB
ss�The :meth:`_expression.GenerativeSelect.append_group_by` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.GenerativeSelect.group_by`.cGs|jj||�dS(s\Append the given GROUP BY criterion applied to this selectable.

        The criterion will be appended to any pre-existing GROUP BY criterion.

        This is an **in-place** mutation method; the
        :meth:`_expression.GenerativeSelect.group_by` method is preferred,
        as it
        provides standard :term:`method chaining`.


        N(tgroup_byR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytappend_group_byZ
s(R1R2RAR+RZR�R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�;
stGenerativeSelectc	Bs�eZdZdZdZdZdZdZdZ	dZ
ejdd�e
edddddd��Zeeedeed��Zd�Zd�Zejdd	d
�d��Zed��Zed
��Zddd�Zd�Zed��Zd�Zed��Zed��Zed��Zeeed��Z ed��Z!eej"d�d���Z#ed��Z$ed��Z%RS(s&Base class for SELECT statements where additional elements can be
    added.

    This serves as the base for :class:`_expression.Select` and
    :class:`_expression.CompoundSelect`
    where elements such as ORDER BY, GROUP BY can be added and column
    rendering can be controlled.  Compare to
    :class:`_expression.TextualSelect`, which,
    while it subclasses :class:`_expression.SelectBase`
    and is also a SELECT construct,
    represents a fixed textual string which cannot be altered at this level,
    only wrapped as a subquery.

    Rs2.0s^The :paramref:`_sql.select.bind` argument is deprecated and will be removed in SQLAlchemy 2.0.cCs�|r.tjr%tjddd�nt}n||_|dk	rY|jj||�n|dk	r{|jj||�n|dk	r�|j	j|tj
|��n|dk	r�|jj|tj
|��n||_dS(Ns�The use_labels=True keyword argument to GenerativeSelect is deprecated and will be removed in version 2.0. Please use select.set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL) if you need to replicate this legacy behavior.t
stackleveli(
R+tSQLALCHEMY_WARN_20twarn_deprecated_20R�R�RYtlimitR�toffsetR�R~R�t_bind(R/R�t
use_labelsR�R�R�R�R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
s 	
		cCs.td|d|d|d|d|�|_dS(s�Specify a ``FOR UPDATE`` clause for this
        :class:`_expression.GenerativeSelect`.

        E.g.::

            stmt = select(table).with_for_update(nowait=True)

        On a database like PostgreSQL or Oracle, the above would render a
        statement like::

            SELECT table.a, table.b FROM table FOR UPDATE NOWAIT

        on other backends, the ``nowait`` option is ignored and instead
        would produce::

            SELECT table.a, table.b FROM table FOR UPDATE

        When called with no arguments, the statement will render with
        the suffix ``FOR UPDATE``.   Additional arguments can then be
        provided which allow for common database-specific
        variants.

        :param nowait: boolean; will render ``FOR UPDATE NOWAIT`` on Oracle
         and PostgreSQL dialects.

        :param read: boolean; will render ``LOCK IN SHARE MODE`` on MySQL,
         ``FOR SHARE`` on PostgreSQL.  On PostgreSQL, when combined with
         ``nowait``, will render ``FOR SHARE NOWAIT``.

        :param of: SQL expression or list of SQL expression elements
         (typically :class:`_schema.Column`
         objects or a compatible expression) which
         will render into a ``FOR UPDATE OF`` clause; supported by PostgreSQL
         and Oracle.  May render as a table or as a column depending on
         backend.

        :param skip_locked: boolean, will render ``FOR UPDATE SKIP LOCKED``
         on Oracle and PostgreSQL dialects or ``FOR SHARE SKIP LOCKED`` if
         ``read=True`` is also specified.

        :param key_share: boolean, will render ``FOR NO KEY UPDATE``,
         or if combined with ``read=True`` will render ``FOR KEY SHARE``,
         on the PostgreSQL dialect.

        RuRvRtRwRzN(Rst_for_update_arg(R/RuRvRtRwRz((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRx�
s6cCs|jS(sS
        Retrieve the current label style.

        .. versionadded:: 1.4

        (R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��
scCs+|j|k	r'|j�}||_n|S(s8Return a new selectable with the specified label style.

        There are three "label styles" available,
        :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY`,
        :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL`, and
        :data:`_sql.LABEL_STYLE_NONE`.   The default style is
        :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL`.

        In modern SQLAlchemy, there is not generally a need to change the
        labeling style, as per-expression labels are more effectively used by
        making use of the :meth:`_sql.ColumnElement.label` method. In past
        versions, :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL` was used to
        disambiguate same-named columns from different tables, aliases, or
        subqueries; the newer :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY` now
        applies labels only to names that conflict with an existing name so
        that the impact of this labeling is minimal.

        The rationale for disambiguation is mostly so that all column
        expressions are available from a given :attr:`_sql.FromClause.c`
        collection when a subquery is created.

        .. versionadded:: 1.4 - the
            :meth:`_sql.GenerativeSelect.set_label_style` method replaces the
            previous combination of ``.apply_labels()``, ``.with_labels()`` and
            ``use_labels=True`` methods and/or parameters.

        .. seealso::

            :data:`_sql.LABEL_STYLE_DISAMBIGUATE_ONLY`

            :data:`_sql.LABEL_STYLE_TABLENAME_PLUS_COL`

            :data:`_sql.LABEL_STYLE_NONE`

            :data:`_sql.LABEL_STYLE_DEFAULT`

        (R�t	_generate(R/tstyle((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
s&s*:meth:`_sql.GenerativeSelect.apply_labels`R	s<Use set_label_style(LABEL_STYLE_TABLENAME_PLUS_COL) instead.cCs
|jt�S(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytapply_labels%scCstjtj|j�S(s9ClauseList access to group_by_clauses for legacy dialects(R"t_construct_rawRtcomma_opt_group_by_clauses(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_group_by_clause-scCstjtj|j�S(s9ClauseList access to order_by_clauses for legacy dialects(R"R�RR�t_order_by_clauses(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_order_by_clause4scCstjtj|d|d|�S(s�Convert the given value to an "offset or limit" clause.

        This handles incoming integers and converts to an expression; if
        an expression is already given, it is passed through.

        RLttype_(RRhRtLimitOffsetRole(R/RRLR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_offset_or_limit_clause;scCsd|dkrdSy
|j}Wn3tk
rR}tjtjd|�d|�nXtj|�SdS(s�Convert the "offset or limit" clause of a select construct to an
        integer.

        This is only possible if the value is stored as a simple bound
        parameter. Otherwise, a compilation error is raised.

        s@This SELECT structure does not use a simple integer value for %streplace_contextN(RYR0tAttributeErrorR+traise_R*tCompileErrortasint(R/tclausetattrnametvalueterr((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_offset_or_limit_clause_asintFs

cCs|j|jd�S(s�Get an integer value for the limit.  This should only be used
        by code that cannot support a limit as a BindParameter or
        other custom clause as it will throw an exception if the limit
        isn't currently set to an integer.

        R�(R�t
_limit_clause(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_limit]scCs
t|t�S(skTrue if the clause is a simple integer, False
        if it is not present or is a SQL expression.
        (R�R-(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_simple_int_clausegscCs|j|jd�S(s�Get an integer value for the offset.  This should only be used
        by code that cannot support an offset as a BindParameter or
        other custom clause as it will throw an exception if the
        offset isn't currently set to an integer.

        R�(R�t_offset_clause(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_offsetmscCs+|jdk	p*|jdk	p*|jdk	S(N(R�RYR�t
_fetch_clause(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_has_row_limiting_clauseyscCs&d|_|_|j|�|_dS(sfReturn a new selectable with the given LIMIT criterion
        applied.

        This is a numerical value which usually renders as a ``LIMIT``
        expression in the resulting select.  Backends that don't
        support ``LIMIT`` will attempt to provide similar
        functionality.

        .. note::

           The :meth:`_sql.GenerativeSelect.limit` method will replace
           any clause applied with :meth:`_sql.GenerativeSelect.fetch`.

        .. versionchanged:: 1.0.0 - :meth:`_expression.Select.limit` can now
           accept arbitrary SQL expressions as well as integer values.

        :param limit: an integer LIMIT parameter, or a SQL expression
         that provides an integer result. Pass ``None`` to reset it.

        .. seealso::

           :meth:`_sql.GenerativeSelect.fetch`

           :meth:`_sql.GenerativeSelect.offset`

        N(RYR�t_fetch_clause_optionsR�R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCsUd|_|dkr(d|_|_n)|j|�|_i|d6|d6|_dS(s�Return a new selectable with the given FETCH FIRST criterion
        applied.

        This is a numeric value which usually renders as
        ``FETCH {FIRST | NEXT} [ count ] {ROW | ROWS} {ONLY | WITH TIES}``
        expression in the resulting select. This functionality is
        is currently implemented for Oracle, PostgreSQL, MSSQL.

        Use :meth:`_sql.GenerativeSelect.offset` to specify the offset.

        .. note::

           The :meth:`_sql.GenerativeSelect.fetch` method will replace
           any clause applied with :meth:`_sql.GenerativeSelect.limit`.

        .. versionadded:: 1.4

        :param count: an integer COUNT parameter, or a SQL expression
         that provides an integer result. When ``percent=True`` this will
         represent the percentage of rows to return, not the absolute value.
         Pass ``None`` to reset it.

        :param with_ties: When ``True``, the WITH TIES option is used
         to return any additional rows that tie for the last place in the
         result set according to the ``ORDER BY`` clause. The
         ``ORDER BY`` may be mandatory in this case. Defaults to ``False``

        :param percent: When ``True``, ``count`` represents the percentage
         of the total number of selected rows to return. Defaults to ``False``

        .. seealso::

           :meth:`_sql.GenerativeSelect.limit`

           :meth:`_sql.GenerativeSelect.offset`

        t	with_tiestpercentN(RYR�R�R�R�(R/tcountR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytfetch�s(	cCs|j|�|_dS(s�Return a new selectable with the given OFFSET criterion
        applied.


        This is a numeric value which usually renders as an ``OFFSET``
        expression in the resulting select.  Backends that don't
        support ``OFFSET`` will attempt to provide similar
        functionality.


        .. versionchanged:: 1.0.0 - :meth:`_expression.Select.offset` can now
           accept arbitrary SQL expressions as well as integer values.

        :param offset: an integer OFFSET parameter, or a SQL expression
         that provides an integer result. Pass ``None`` to reset it.

        .. seealso::

           :meth:`_sql.GenerativeSelect.limit`

           :meth:`_sql.GenerativeSelect.fetch`

        N(R�R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��sssqlalchemy.sql.utilcCsJtjj}d|_|_|j|j|j||�\|_|_dS(sApply LIMIT / OFFSET to this statement based on a slice.

        The start and stop indices behave like the argument to Python's
        built-in :func:`range` function. This method provides an
        alternative to using ``LIMIT``/``OFFSET`` to get a slice of the
        query.

        For example, ::

            stmt = select(User).order_by(User).id.slice(1, 3)

        renders as

        .. sourcecode:: sql

           SELECT users.id AS users_id,
                  users.name AS users_name
           FROM users ORDER BY users.id
           LIMIT ? OFFSET ?
           (2, 1)

        .. note::

           The :meth:`_sql.GenerativeSelect.slice` method will replace
           any clause applied with :meth:`_sql.GenerativeSelect.fetch`.

        .. versionadded:: 1.4  Added the :meth:`_sql.GenerativeSelect.slice`
           method generalized from the ORM.

        .. seealso::

           :meth:`_sql.GenerativeSelect.limit`

           :meth:`_sql.GenerativeSelect.offset`

           :meth:`_sql.GenerativeSelect.fetch`

        N(	R+RORPRYR�R�t_make_sliceR�R�(R/tstarttstopRP((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytslice�s)cGsQt|�dkr.|ddkr.d|_n|jtd�|D��7_dS(s�Return a new selectable with the given list of ORDER BY
        criteria applied.

        e.g.::

            stmt = select(table).order_by(table.c.id, table.c.name)

        Calling this method multiple times is equivalent to calling it once
        with all the clauses concatenated. All existing ORDER BY criteria may
        be cancelled by passing ``None`` by itself.  New ORDER BY criteria may
        then be added by invoking :meth:`_orm.Query.order_by` again, e.g.::

            # will erase all ORDER BY and ORDER BY new_col alone
            stmt = stmt.order_by(None).order_by(new_col)

        :param \*clauses: a series of :class:`_expression.ColumnElement`
         constructs
         which will be used to generate an ORDER BY clause.

        .. seealso::

            :ref:`tutorial_order_by` - in the :ref:`unified_tutorial`

            :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`

        iicss$|]}tjtj|�VqdS(N(RRhRtOrderByRole(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>?sN((R�RYR�Rg(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s
"
cGsQt|�dkr.|ddkr.d|_n|jtd�|D��7_dS(s~Return a new selectable with the given list of GROUP BY
        criterion applied.

        All existing GROUP BY settings can be suppressed by passing ``None``.

        e.g.::

            stmt = select(table.c.name, func.max(table.c.stat)).\
            group_by(table.c.name)

        :param \*clauses: a series of :class:`_expression.ColumnElement`
         constructs
         which will be used to generate an GROUP BY clause.

        .. seealso::

            :ref:`tutorial_group_by_w_aggregates` - in the
            :ref:`unified_tutorial`

            :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`

        iicss$|]}tjtj|�VqdS(N(RRhRtGroupByRole(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>`sN((R�RYR�Rg(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Cs
"
((N(s2.0s^The :paramref:`_sql.select.bind` argument is deprecated and will be removed in SQLAlchemy 2.0.(&R1R2RAR�R�RYR�R�R�R�R�R+R�tLABEL_STYLE_DEFAULTRCR�RRxR�RRR�R5R�R�R�R�R�R�R�R�R�R�R�R[R�R�R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�p
sZ	7			+	
	 1.%tdefaulttcompound_selecttCompoundSelectStatecBseZejd��ZRS(cCs>|jj�}t|_td�|jD��}|||fS(Ncss|]}|j|fVqdS(N(R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>ls(t	statementR8RCR�tdictR�(R/thacky_subquerytd((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_label_resolve_dictgs	(R1R2R+R�R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�estCompoundSelectc
Bs�eZdZdZdejfdejfdejfdejfdejfdejfdejfd	ejfd
ejfg	e	j
Zej
d�Zej
d�Zej
d
�Zej
d�Zej
d�Zej
d�ZeZd�Zed��Zed��Zed��Zed��Zed��Zed��Zd�Zd'd�Z d�Z!d�Z"d�Z#d�Z$d�Z%e&d��Z'e&d ��Z(e&ej)d!d"d#d$e*�d%���Z+e+j,d&��Z+RS((sXForms the basis of ``UNION``, ``UNION ALL``, and other
    SELECT-based set operations.


    .. seealso::

        :func:`_expression.union`

        :func:`_expression.union_all`

        :func:`_expression.intersect`

        :func:`_expression.intersect_all`

        :func:`_expression.except`

        :func:`_expression.except_all`

    R�tselectsR�R�R�R�R�R�R�tkeywordtUNIONs	UNION ALLtEXCEPTs
EXCEPT ALLt	INTERSECTs
INTERSECT ALLcOs�|jdt�|_||_g|D]'}tjtj|�jd|�^q%|_	|rzt
jrzt
jddd�nt
j||�dS(NR
R�s�Set functions such as union(), union_all(), extract(), etc. in SQLAlchemy 2.0 will accept a series of SELECT statements only. Please use generative methods such as order_by() for additional modifications to this CompoundSelect.R�i(RaRCt_auto_correlateR�RRhRtCompoundElementRoleR�R�R+R�R�R�R�(R/R�R�R;ts((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s	4
cOsttj||�S(s�Return a ``UNION`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        A similar :func:`union()` method is available on all
        :class:`_expression.FromClause` subclasses.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�R�(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
_create_union�scOsttj||�S(s�Return a ``UNION ALL`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        A similar :func:`union_all()` method is available on all
        :class:`_expression.FromClause` subclasses.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�t	UNION_ALL(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_union_all�scOsttj||�S(s]Return an ``EXCEPT`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�R�(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_except�scOsttj||�S(saReturn an ``EXCEPT ALL`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�t
EXCEPT_ALL(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_except_all�scOsttj||�S(s`Return an ``INTERSECT`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�R�(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_intersect�scOsttj||�S(sdReturn an ``INTERSECT ALL`` of multiple selectables.

        The returned object is an instance of
        :class:`_expression.CompoundSelect`.

        :param \*selects:
          a list of :class:`_expression.Select` instances.

        :param \**kwargs:
          available keyword arguments are the same as those of
          :func:`select`.

        (R�t
INTERSECT_ALL(R�R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_intersect_all
scCs|jdj�S(Ni(R�t_scalar_type(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scCs
t|�S(N(R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�!scCs+x$|jD]}|j|�r
tSq
WtS(N(R�R�R3RC(R/R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�$scCsO|j|k	rK|j�}|jdj|�}|g|jd|_n|S(Nii(R�R�R�t_set_label_style(R/R�tselect_0((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�*s
cCsP|jdj�}||jdk	rL|j�}|g|jd|_n|S(Nii(R�R�R�(R/t
new_select((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�2s
cCs�|jd}|jtk	r1|j|j�}n|j|�x~t|jjtg|jD]}|j^qZ��D]H\}}gt	|�D]&\}}|j
i|dd6�^q�|_qsWdS(Niitweight(R�R�R�RR�tzipR�t_all_columnsR�t	enumeratet	_annotatet_proxies(R/R8R�R�tsubq_coltselect_colstiR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�:s

	2cCs;tt|�j|�x|jD]}|j|�q WdS(N(R�R�RIR�(R/RHR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRIZscCs|jdjS(Ni(R�R?(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR?_scCs|jdjS(s\A :class:`_expression.ColumnCollection`
        representing the columns that
        this SELECT statement or similar construct returns in its result set,
        not including :class:`_sql.TextClause` constructs.

        For a :class:`_expression.CompoundSelect`, the
        :attr:`_expression.CompoundSelect.selected_columns`
        attribute returns the selected
        columns of the first SELECT statement contained within the series of
        statements within the set operation.

        .. seealso::

            :attr:`_sql.Select.selected_columns`

        .. versionadded:: 1.4

        i(R�R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�css:attr:`.Executable.bind`R	s5Bound metadata is being removed as of SQLAlchemy 2.0.R
cCs?|jr|jSx(|jD]}|j}|r|SqWdSdS(s�Returns the :class:`_engine.Engine` or :class:`_engine.Connection`
        to which this :class:`.Executable` is bound, or None if none found.

        N(R�R�RRY(R/R�te((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRys		cCs
||_dS(N(R�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�sN(-R1R2RARWR)RPRt
dp_plain_dictRpRt%_clone_annotations_traverse_internalsRR+tsymbolR�R�R�R�R�R�R3R+R�RR�R�R�R�R�R�R�RYR�R�R�R�R�RIR5R?R�RRCRtsetter(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�psR
						 	tDeprecatedSelectGenerationscBs�eZdZejdd�d��Zejdd�d��Zejdd�d��Zejdd�d	��Zejdd
�d��Z	ejdd�d
��Z
RS(s�A collection of methods available on :class:`_sql.Select`, these
    are all **deprecated** methods as they modify the :class:`_sql.Select`
    object in -place.

    s1.4s�The :meth:`_expression.Select.append_correlation` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.correlate`.cCs|jj||�dS(sAppend the given correlation expression to this select()
        construct.

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.correlate` method is preferred,
        as it provides
        standard :term:`method chaining`.

        N(R
R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytappend_correlation�ss�The :meth:`_expression.Select.append_column` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.add_columns`.cCs|jj||�dS(soAppend the given column expression to the columns clause of this
        select() construct.

        E.g.::

            my_select.append_column(some_table.c.new_column)

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.add_columns` method is preferred,
        as it provides standard
        :term:`method chaining`.

        N(tadd_columnsR�(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRb�ss�The :meth:`_expression.Select.append_prefix` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.prefix_with`.cCs|jj||�dS(sAppend the given columns clause prefix expression to this select()
        construct.

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.prefix_with` method is preferred,
        as it provides
        standard :term:`method chaining`.

        N(RfR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
append_prefix�ss�The :meth:`_expression.Select.append_whereclause` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.where`.cCs|jj||�dS(s\Append the given expression to this select() construct's WHERE
        criterion.

        The expression will be joined to existing WHERE criterion via AND.

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.where` method is preferred,
        as it provides standard
        :term:`method chaining`.

        N(twhereR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytappend_whereclause�ss�The :meth:`_expression.Select.append_having` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.having`.cCs|jj||�dS(s_Append the given expression to this select() construct's HAVING
        criterion.

        The expression will be joined to existing HAVING criterion via AND.

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.having` method is preferred,
        as it provides standard
        :term:`method chaining`.

        N(thavingR�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
append_having�ss�The :meth:`_expression.Select.append_from` method is deprecated and will be removed in a future release.  Use the generative method :meth:`_expression.Select.select_from`.cCs|jj||�dS(s2Append the given :class:`_expression.FromClause` expression
        to this select() construct's FROM clause.

        This is an **in-place** mutation method; the
        :meth:`_expression.Select.select_from` method is preferred,
        as it provides
        standard :term:`method chaining`.

        N(RR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytappend_from�s(R1R2RAR+RZRRbRRR	R
(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s&R�tSelectStatecBseZdZdefd��YZd�Zed��Zed��Zed	��Z	ed
��Z
ed��Zd�Zedd
��Zddd�Zd�Zed��Zed��Zd�Zejd�d��Zejd�d��ZRS(tfrom_clausestfromstcolumns_plus_namesR�tdefault_select_compile_optionscBseZgZRS((R1R2t_cache_key_traversal(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRscKs�||_|j|_x'|jD]}|j|j|j�qW|jra|j|j|j�n|j|�|_|jt	�|_
dS(N(R�t	_from_objRt_memoized_select_entitiest_setup_joinst_raw_columnst
_get_fromsR
R�R3R(R/R�tcompilerRetmemoized_entities((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s		cCstd��dS(NsLThe default SELECT construct without plugins does not implement this method.(R>(R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_plugin_not_implemented.scCsGg|jt�D]3\}}}}}i|d6|jd6|d6^qS(NRLR�R^(R�RCR�(R�R�t_RLR((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytget_column_descriptions5scCs|j�dS(N(R(R�R�tfrom_statement((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRBscCs&|jtjjd�|jD���S(Ncss|]}|jVqdS(N(R(R�R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>Js(t_normalize_fromsR�R�t
from_iterableR(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytget_columns_clause_fromsFs	csI|tk�|tk	�t��t��d����fd�}|S(Ncs�|jr
dS�s5|j}|dkr1d}n|S�rD|jn|j}|dkr�d}|�kr||j|��S�j|�|Sn9|�kr��r�|j�S|j�S�j|�|SdS(Nt	_no_label(t_is_text_clauseRYt
_proxy_keyR�t_anon_labelRft_anon_tq_key_labelt_anon_key_label(R�tcol_nameRL(Rtnamestpattable_qualified(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytgoWs&			

(R�R�RR�RY(R�R�R)((RR&R'R(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_column_naming_conventionNs		cCso|jtjtjjg|jD]}|j^q�tjjg|jD]}|j^qG�|j�d|�S(Ntcheck_statement(RR�R�RRRt_where_criteriaR(R/R�R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRws		cCs�t�}g}xj|D]b}|jrF|j|krFtjd��n|j|j�s|j|�|j|j�qqW|r�tt	j
jg|D]}t|j
�^q���}|r�g|D]}||kr�|^q�}q�n|S(s0given an iterable of things to select FROM, reduce them to what
        would actually render in the FROM clause of a SELECT.

        This does the job of checking for JOINs, tables, etc. that are in fact
        overlapping due to cloning, adaption, present in overlapping joins,
        etc.

        s-select() construct refers to itself as a FROM(R�R]RR*tInvalidRequestErrorR�R�RR�R�R�RR
R�(R�titerable_of_fromsR+tseenR
titemR�ttoremove((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s 
	

	(+cCs@|j}|jjrj|jj}|rjg|D]0}|tt||pId�|�kr.|^q.}qjn|jjdk	r�g|D]6}|tt||p�d�|jj�kr�|^q�}n|jjr<|r<t|�dkr<g|D]!}|t||�kr�|^q�}t|�s<t	j
d|j��q<n|S(sReturn the full list of 'from' clauses to be displayed.

        Takes into account a set of existing froms which may be
        rendered in the FROM clause of enclosing selects; this Select
        may want to leave those absent if it is automatically
        correlating.

        is�Select statement '%r' returned no FROM clauses due to auto-correlation; specify correlate(<tables>) to control correlation manually.(N((R
R�t
_correlateRt_correlate_exceptRYR
R�R�R*R-(R/texplicit_correlate_fromstimplicit_correlate_fromsR
tto_correlateR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_get_display_froms�s>	

!
cCs�td�|jjD��}td�t|j�D��}|j�}x*|j�D]\}}|j||�qTW|||fS(Ncss0|]&}|jr|jp!|j|fVqdS(N(t_allow_label_resolvet	_tq_labelR�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�scss'|]}|jr|j|fVqdS(N(R8R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�s(R�R�R?RR
tcopytitemst
setdefault(R/t	with_colst
only_fromst	only_colsR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt"_memoized_attr__label_resolve_dict�scCs |jr|jddSdSdS(Ni����i(RRY(R�tstmt((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytdetermine_last_joined_entitys	cCs gt|j�D]}|^qS(N(RR(R�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytall_selected_columnssc
Cs�x�|D]�\}}}}|d}|d}|dkrZ|j||||�\}}	n|j|�}	|	dk	r�|j|	}
|j|	 t|
||d|d|�f|j|	d|_q|jt|||d|d|�f|_qWdS(NR�R�i(RYt"_join_determine_implicit_left_sidet_join_place_explicit_left_sideRR�(R/R:traw_columnsR�R�R�tflagsR�R�treplace_from_obj_indextleft_clause((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRs

	

Assqlalchemy.sql.utilcCsvtjj}d}|j}|rb|j|||�}t|�dkr)|d}||}q)n�i}	|j}
xktj	tj	j
g|D]}|j^q��tj	j
g|
jD]}|j^q���D]}d|	|<q�Wt
|	j��}
|j|
||�}t|�dkr)|
|d}nt|�dkrMtjd��n|sltjd|f��n||fS(s�When join conditions don't express the left side explicitly,
        determine if an existing FROM or entity in this query
        can serve as the left hand side.

        iisCan't determine which FROM clause to join from, there are multiple FROMS which can join to this entity. Please use the .select_from() method to establish an explicit left side, as well as providing an explicit ON clause if not present already to help resolve the ambiguity.s�Don't know how to join to %r. Please use the .select_from() method to establish an explicit left side, as well as providing an explicit ON clause if not present already to help resolve the ambiguity.N((R+RORPRYRtfind_left_clause_to_join_fromR�R�R�R�RRR,R�tkeysR*R-(R/RFR�R�R�RPRHRtindexest	potentialR�Rtfrom_clausetall_clauses((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRD8s>
	
				&cCs�d}tjj}t|jj��}|rE|j|j|�}ng}t	|�dkrot
jd��n|r�|d}n|S(NisrCan't identify which entity in which to assign the left side of this join.   Please use a more specific ON clause.i(RYR+RORPR�R�t_iterate_from_elementst#find_left_clause_that_matches_givenRR�R*R-(R/R�RHRPRRL((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRE~s
(RR
RR�N(R1R2t	__slots__RRR�RRRRRR*RRYRR7R@RBRCRR+R[RDRE(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRs*	
)	$C		)Ft_SelectFromElementscBseZd�ZRS(ccs�t�}xI|jD]>}x5|jD]*}||kr;q#n|j|�|Vq#WqWxI|jD]>}x5|jD]*}||kr�qon|j|�|VqoWq_Wx5|jD]*}||kr�q�n|j|�|Vq�WdS(N(R�RRRfR,R(R/R/Rtfr((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRP�s$	




(R1R2RP(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRS�st_MemoizedSelectEntitiescBseeZdZdejfdejfdejfdejfgZej	Z
d�Zed��Z
RS(tmemoized_select_entitiesRRt_legacy_setup_joinst
_with_optionscKsM|jj|j�}d�|jj�D�|_|jjd|�|_|S(NcSsi|]\}}||�qS(((R�tktv((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys
<dictcomp>�s	t_is_clone_of(R�RR�R;tgetR[(R/ReR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR	�scCs�|js|js|jr�t�}|j|_|j|_|j|_|j|_|j|f7_d|_|_|_|_ndS(N((RRWRXRURR(R�tselect_stmtR/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_generate_for_statement�s				(R1R2RWR)RPtdp_setup_join_tupletdp_executable_optionsRR+t
EMPTY_DICTt_annotationsR	RR^(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRU�s		R6cBs�eZdZdZfZfZfZeZfZ	fZ
eZfZ
fZfZeZejZdejfdejfdejfdejfdejfdejfdejfd	ejfd
ejfdejfdejfd
ejfdejfdejfdejfdejfdejfdejfdejfgeje j!e"j#e$j%e&j'e(j)Z*e*dej+fgZ,e-d��Z.e-e/j0dd�eeeeeeeed���Z1e-d��Z2e2Z3e-d��Z4e-d��Z5d�Z6d�Z7d�Z8d �Z9d!�Z:e;d"��Z<d#�Z=e>eeed$��Z?eed%�Z@e>eeed&��ZAeed'�ZBd(�ZCe;e/j0d)d*�d+���ZDe;d,��ZEe;d-��ZFd.�ZGeHd/�ZId0�ZJe>d1��ZKd2�ZLe/j0d3d4�d5��ZMe/jNd6�ed7��ZOe>d8��ZPe;d9��ZQeQZRe>d:��ZSe>d;��ZTe>d<��ZUe>d=��ZVe>d>��ZWe>d?��ZXeYjZd@��Z[eYjZdA��Z\dB�Z]edC�Z^dD�Z_dE�Z`edF�ZadG�ZbdH�ZcdI�ZddJ�ZedK�ZfdL�Zge;e/jhdMdNdOdPe�dQ���ZieijjdR��ZiRS(SsRepresents a ``SELECT`` statement.

    The :class:`_sql.Select` object is normally constructed using the
    :func:`_sql.select` function.  See that function for details.

    .. seealso::

        :func:`_sql.select`

        :ref:`tutorial_selecting_data` - in the 2.0 tutorial

    R�RRRR,t_having_criteriaR�R�RRWR2R3R�R�R�R�R�t	_distinctt_distinct_onR�t_compile_optionscOs0|s|rtj|||�Stj|�SdS(N(R6R7t_create_select(R�ttargettentitiesRRe((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�.ss2.0s�The legacy calling style of :func:`_sql.select` is deprecated and will be removed in SQLAlchemy 2.0.  Please use the new calling style described at :func:`_sql.select`.c	Ks�|j|�}
||
_|tk	rb|tkrC|
jj|
�qb|
jj|
tj|��n|dk	r�|
j	j|
tj|��nyt
|�}Wn5tk
r�}tjt
jddd�d|�nX|rg|D]!}
tjtj|
d|
�^q�|
_n	g|
_|dk	r:|
jj|
|�n|dk	r\|
jj|
|�n|rr|
j|�n|r�|
j|�ntj|
|	�|
S(sConstruct a new :class:`_expression.Select` using the 1.x style API.

        This method is called implicitly when the :func:`_expression.select`
        construct is used and the first argument is a Python list or other
        plain sequence object, which is taken to refer to the columns
        collection.

        .. versionchanged:: 1.4 Added the :meth:`.Select.create_legacy_select`
           constructor which documents the calling style in use when the
           :func:`.select` construct is invoked using 1.x-style arguments.

        Similar functionality is also available via the
        :meth:`_expression.FromClause.select` method on any
        :class:`_expression.FromClause`.

        All arguments which accept :class:`_expression.ClauseElement` arguments
        also accept string arguments, which will be converted as appropriate
        into either :func:`_expression.text()` or
        :func:`_expression.literal_column()` constructs.

        .. seealso::

            :ref:`tutorial_selecting_data` - in the :ref:`unified_tutorial`

        :param columns:
          A list of :class:`_expression.ColumnElement` or
          :class:`_expression.FromClause`
          objects which will form the columns clause of the resulting
          statement.   For those objects that are instances of
          :class:`_expression.FromClause` (typically :class:`_schema.Table`
          or :class:`_expression.Alias`
          objects), the :attr:`_expression.FromClause.c`
          collection is extracted
          to form a collection of :class:`_expression.ColumnElement` objects.

          This parameter will also accept :class:`_expression.TextClause`
          constructs as
          given, as well as ORM-mapped classes.

          .. note::

            The :paramref:`_expression.select.columns`
            parameter is not available
            in the method form of :func:`_expression.select`, e.g.
            :meth:`_expression.FromClause.select`.

          .. seealso::

            :meth:`_expression.Select.column`

            :meth:`_expression.Select.with_only_columns`

        :param whereclause:
          A :class:`_expression.ClauseElement`
          expression which will be used to form the
          ``WHERE`` clause.   It is typically preferable to add WHERE
          criterion to an existing :class:`_expression.Select`
          using method chaining
          with :meth:`_expression.Select.where`.

          .. seealso::

            :meth:`_expression.Select.where`

        :param from_obj:
          A list of :class:`_expression.ClauseElement`
          objects which will be added to the
          ``FROM`` clause of the resulting statement.  This is equivalent
          to calling :meth:`_expression.Select.select_from`
          using method chaining on
          an existing :class:`_expression.Select` object.

          .. seealso::

            :meth:`_expression.Select.select_from`
            - full description of explicit
            FROM clause specification.

        :param bind=None:
          an :class:`_engine.Engine` or :class:`_engine.Connection` instance
          to which the
          resulting :class:`_expression.Select` object will be bound.  The
          :class:`_expression.Select`
          object will otherwise automatically bind to
          whatever :class:`~.base.Connectable` instances can be located within
          its contained :class:`_expression.ClauseElement` members.

        :param correlate=True:
          indicates that this :class:`_expression.Select`
          object should have its
          contained :class:`_expression.FromClause`
          elements "correlated" to an enclosing
          :class:`_expression.Select` object.
          It is typically preferable to specify
          correlations on an existing :class:`_expression.Select`
          construct using
          :meth:`_expression.Select.correlate`.

          .. seealso::

            :meth:`_expression.Select.correlate`
            - full description of correlation.

        :param distinct=False:
          when ``True``, applies a ``DISTINCT`` qualifier to the columns
          clause of the resulting statement.

          The boolean argument may also be a column expression or list
          of column expressions - this is a special calling form which
          is understood by the PostgreSQL dialect to render the
          ``DISTINCT ON (<columns>)`` syntax.

          ``distinct`` is also available on an existing
          :class:`_expression.Select`
          object via the :meth:`_expression.Select.distinct` method.

          .. seealso::

            :meth:`_expression.Select.distinct`

        :param group_by:
          a list of :class:`_expression.ClauseElement`
          objects which will comprise the
          ``GROUP BY`` clause of the resulting select.  This parameter
          is typically specified more naturally using the
          :meth:`_expression.Select.group_by` method on an existing
          :class:`_expression.Select`.

          .. seealso::

            :meth:`_expression.Select.group_by`

        :param having:
          a :class:`_expression.ClauseElement`
          that will comprise the ``HAVING`` clause
          of the resulting select when ``GROUP BY`` is used.  This parameter
          is typically specified more naturally using the
          :meth:`_expression.Select.having` method on an existing
          :class:`_expression.Select`.

          .. seealso::

            :meth:`_expression.Select.having`

        :param limit=None:
          a numerical value which usually renders as a ``LIMIT``
          expression in the resulting select.  Backends that don't
          support ``LIMIT`` will attempt to provide similar
          functionality.    This parameter is typically specified more
          naturally using the :meth:`_expression.Select.limit`
          method on an existing
          :class:`_expression.Select`.

          .. seealso::

            :meth:`_expression.Select.limit`

        :param offset=None:
          a numeric value which usually renders as an ``OFFSET``
          expression in the resulting select.  Backends that don't
          support ``OFFSET`` will attempt to provide similar
          functionality.  This parameter is typically specified more naturally
          using the :meth:`_expression.Select.offset` method on an existing
          :class:`_expression.Select`.

          .. seealso::

            :meth:`_expression.Select.offset`

        :param order_by:
          a scalar or list of :class:`_expression.ClauseElement`
          objects which will
          comprise the ``ORDER BY`` clause of the resulting select.
          This parameter is typically specified more naturally using the
          :meth:`_expression.Select.order_by` method on an existing
          :class:`_expression.Select`.

          .. seealso::

            :meth:`_expression.Select.order_by`

        :param use_labels=False:
          when ``True``, the statement will be generated using labels
          for each column in the columns clause, which qualify each
          column with its parent table's (or aliases) name so that name
          conflicts between columns in different tables don't occur.
          The format of the label is ``<tablename>_<column>``.  The "c"
          collection of a :class:`_expression.Subquery` created
          against this :class:`_expression.Select`
          object, as well as the :attr:`_expression.Select.selected_columns`
          collection of the :class:`_expression.Select` itself, will use these
          names for targeting column members.

          This parameter can also be specified on an existing
          :class:`_expression.Select` object using the
          :meth:`_expression.Select.set_label_style`
          method.

          .. seealso::

            :meth:`_expression.Select.set_label_style`

        s�select() construct created in legacy mode, i.e. with keyword arguments, must provide the columns argument as a Python list or other iterable.tcodetc9aetfrom_RN(RR�RCR3tdistinctR�R+R~RYRR�t	TypeErrorR�R*RbRRhRRRRRRdRpR�R�(R�R�R�tfrom_objRmRR
RjRrR;R/tcols_presentR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR75s<�		1	cGsQ|j|�}g|D]!}tjtj|d|�^q|_tj|�|S(sConstruct a new :class:`_expression.Select` using the 2.
        x style API.

        .. versionadded:: 1.4 - The :func:`_sql.select` function now accepts
           column arguments positionally.   The top-level :func:`_sql.select`
           function will automatically use the 1.x or 2.x style API based on
           the incoming arguments; using :func:`_future.select` from the
           ``sqlalchemy.future`` module will enforce that only the 2.x style
           constructor is used.

        Similar functionality is also available via the
        :meth:`_expression.FromClause.select` method on any
        :class:`_expression.FromClause`.

        .. seealso::

            :ref:`coretutorial_selecting` - Core Tutorial description of
            :func:`_expression.select`.

        :param \*entities:
          Entities to SELECT from.  For Core usage, this is typically a series
          of :class:`_expression.ColumnElement` and / or
          :class:`_expression.FromClause`
          objects which will form the columns clause of the resulting
          statement.   For those objects that are instances of
          :class:`_expression.FromClause` (typically :class:`_schema.Table`
          or :class:`_expression.Alias`
          objects), the :attr:`_expression.FromClause.c`
          collection is extracted
          to form a collection of :class:`_expression.ColumnElement` objects.

          This parameter will also accept :class:`_expression.TextClause`
          constructs as
          given, as well as ORM-mapped classes.

        R(RRRhRRRR�R�(R�RiR/tent((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_future_selectFs
'.
cKs#tjt�}|jj|�|S(s�Create a :class:`.Select` using raw ``__new__`` with no coercions.

        Used internally to build up :class:`.Select` constructs with
        pre-established state.

        (R6RR�R�(R�ReRA((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create_raw_select{s	cOs�|rzt|dt�s�t|dd�rzt|dtjtf�rzt|ddt�dkrzt|dd�s�|r�|j	||�S|j
|�SdS(s�Create a :class:`.Select` using either the 1.x or 2.0 constructor
        style.

        For the legacy calling style, see :meth:`.Select.create_legacy_select`.
        If the first argument passed is a Python sequence or if keyword
        arguments are present, this style is used.

        .. versionadded:: 2.0 - the :func:`_future.select` construct is
           the same construct as the one returned by
           :func:`_expression.select`, except that the function only
           accepts the "columns clause" entities up front; the rest of the
           state of the SELECT should be built up using generative methods.

        Similar functionality is also available via the
        :meth:`_expression.FromClause.select` method on any
        :class:`_expression.FromClause`.

        .. seealso::

            :ref:`coretutorial_selecting` - Core Tutorial description of
            :func:`_expression.select`.

        :param \*entities:
          Entities to SELECT from.  For Core usage, this is typically a series
          of :class:`_expression.ColumnElement` and / or
          :class:`_expression.FromClause`
          objects which will form the columns clause of the resulting
          statement.   For those objects that are instances of
          :class:`_expression.FromClause` (typically :class:`_schema.Table`
          or :class:`_expression.Alias`
          objects), the :attr:`_expression.FromClause.c`
          collection is extracted
          to form a collection of :class:`_expression.ColumnElement` objects.

          This parameter will also accept :class:`_expression.TextClause`
          constructs as given, as well as ORM-mapped classes.

        it__iter__traiseerrt__clause_element__N(R�R�thasattrR+tstring_typesR!R,RCRYR7Rr(R�R:Re((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_create�s)cCs
t��dS(N(R>(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs'|jd}t|j�}|djS(Ni(RR�R�R�(R/R�tcols((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
cGs
|j|�S(s6A synonym for the :meth:`_future.Select.where` method.(R(R/tcriteria((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytfilter�scCsY|jr:tj|�j}||�}|dk	r:|Sn|jrN|jdS|jdS(Ni(RRtget_plugin_classRBRYRR(R/tmetht_last_joined_entity((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_filter_by_zero�s		cKsM|j�}g|j�D]!\}}t||�|k^q}|j|�S(sWapply the given filtering criterion as a WHERE clause
        to this select.

        (R�R;RR|(R/R;tfrom_entityR�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt	filter_by�s1cCstj|�j}||�S(s5Return a :term:`plugin-enabled` 'column descriptions' structure
        referring to the columns which are SELECTed by this statement.

        This attribute is generally useful when using the ORM, as an
        extended structure which includes information about mapped
        entities is returned.  The section :ref:`queryguide_inspection`
        contains more background.

        For a Core-only statement, the structure returned by this accessor
        is derived from the same objects that are returned by the
        :attr:`.Select.selected_columns` accessor, formatted as a list of
        dictionaries which contain the keys ``name``, ``type`` and ``expr``,
        which indicate the column expressions to be selected::

            >>> stmt = select(user_table)
            >>> stmt.column_descriptions
            [
                {
                    'name': 'id',
                    'type': Integer(),
                    'expr': Column('id', Integer(), ...)},
                {
                    'name': 'name',
                    'type': String(length=30),
                    'expr': Column('name', String(length=30), ...)}
            ]

        .. versionchanged:: 1.4.33 The :attr:`.Select.column_descriptions`
           attribute returns a structure for a Core-only set of entities,
           not just ORM-only entities.

        .. seealso::

            :attr:`.UpdateBase.entity_description` - entity information for
            an :func:`.insert`, :func:`.update`, or :func:`.delete`

            :ref:`queryguide_inspection` - ORM background

        (RR}R(R/R~((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytcolumn_descriptions�s)cCstj|�j}|||�S(s�Apply the columns which this :class:`.Select` would select
        onto another statement.

        This operation is :term:`plugin-specific` and will raise a not
        supported exception if this :class:`_sql.Select` does not select from
        plugin-enabled entities.


        The statement is typically either a :func:`_expression.text` or
        :func:`_expression.select` construct, and should return the set of
        columns appropriate to the entities represented by this
        :class:`.Select`.

        .. seealso::

            :ref:`orm_queryguide_selecting_text` - usage examples in the
            ORM Querying Guide

        (RR}R(R/R�R~((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRscCsotjtj|d|�}|dk	r?tjtj|�}n|j||di|d6|d6ff7_dS(sh	Create a SQL JOIN against this :class:`_expression.Select`
        object's criterion
        and apply generatively, returning the newly resulting
        :class:`_expression.Select`.

        E.g.::

            stmt = select(user_table).join(address_table, user_table.c.id == address_table.c.user_id)

        The above statement generates SQL similar to::

            SELECT user.id, user.name FROM user JOIN address ON user.id = address.user_id

        .. versionchanged:: 1.4 :meth:`_expression.Select.join` now creates
           a :class:`_sql.Join` object between a :class:`_sql.FromClause`
           source that is within the FROM clause of the existing SELECT,
           and a given target :class:`_sql.FromClause`, and then adds
           this :class:`_sql.Join` to the FROM clause of the newly generated
           SELECT statement.    This is completely reworked from the behavior
           in 1.3, which would instead create a subquery of the entire
           :class:`_expression.Select` and then join that subquery to the
           target.

           This is a **backwards incompatible change** as the previous behavior
           was mostly useless, producing an unnamed subquery rejected by
           most databases in any case.   The new behavior is modeled after
           that of the very successful :meth:`_orm.Query.join` method in the
           ORM, in order to support the functionality of :class:`_orm.Query`
           being available by using a :class:`_sql.Select` object with an
           :class:`_orm.Session`.

           See the notes for this change at :ref:`change_select_join`.


        :param target: target table to join towards

        :param onclause: ON clause of the join.  If omitted, an ON clause
         is generated automatically based on the :class:`_schema.ForeignKey`
         linkages between the two tables, if one can be unambiguously
         determined, otherwise an error is raised.

        :param isouter: if True, generate LEFT OUTER join.  Same as
         :meth:`_expression.Select.outerjoin`.

        :param full: if True, generate FULL OUTER join.

        .. seealso::

            :ref:`tutorial_select_join` - in the :doc:`/tutorial/index`

            :ref:`orm_queryguide_joins` - in the :ref:`queryguide_toplevel`

            :meth:`_expression.Select.join_from`

            :meth:`_expression.Select.outerjoin`

        RR�R�N(RRhRtJoinTargetRoleRYR�R(R/RhR�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRc-s;c	Cs"|j||d|dtd|�S(sCreate a SQL LEFT OUTER JOIN against this
        :class:`_expression.Select` object's criterion and apply generatively,
        returning the newly resulting :class:`_expression.Select`.

        Usage is the same as that of :meth:`_selectable.Select.join_from`.

        R�R�R�(t	join_fromR3(R/RlRhR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytouterjoin_fromqscCs�tjtj|d|�}tjtj|d|�}|dk	rZtjtj|�}n|j|||i|d6|d6ff7_dS(sCreate a SQL JOIN against this :class:`_expression.Select`
        object's criterion
        and apply generatively, returning the newly resulting
        :class:`_expression.Select`.

        E.g.::

            stmt = select(user_table, address_table).join_from(
                user_table, address_table, user_table.c.id == address_table.c.user_id
            )

        The above statement generates SQL similar to::

            SELECT user.id, user.name, address.id, address.email, address.user_id
            FROM user JOIN address ON user.id = address.user_id

        .. versionadded:: 1.4

        :param from\_: the left side of the join, will be rendered in the
         FROM clause and is roughly equivalent to using the
         :meth:`.Select.select_from` method.

        :param target: target table to join towards

        :param onclause: ON clause of the join.

        :param isouter: if True, generate LEFT OUTER join.  Same as
         :meth:`_expression.Select.outerjoin`.

        :param full: if True, generate FULL OUTER join.

        .. seealso::

            :ref:`tutorial_select_join` - in the :doc:`/tutorial/index`

            :ref:`orm_queryguide_joins` - in the :ref:`queryguide_toplevel`

            :meth:`_expression.Select.join`

        RR�R�N(RRhRR}R�RYR�R(R/RlRhR�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�}s1cCs|j|d|dtd|�S(s�Create a left outer join.

        Parameters are the same as that of :meth:`_expression.Select.join`.

        .. versionchanged:: 1.4 :meth:`_expression.Select.outerjoin` now
           creates a :class:`_sql.Join` object between a
           :class:`_sql.FromClause` source that is within the FROM clause of
           the existing SELECT, and a given target :class:`_sql.FromClause`,
           and then adds this :class:`_sql.Join` to the FROM clause of the
           newly generated SELECT statement.    This is completely reworked
           from the behavior in 1.3, which would instead create a subquery of
           the entire
           :class:`_expression.Select` and then join that subquery to the
           target.

           This is a **backwards incompatible change** as the previous behavior
           was mostly useless, producing an unnamed subquery rejected by
           most databases in any case.   The new behavior is modeled after
           that of the very successful :meth:`_orm.Query.join` method in the
           ORM, in order to support the functionality of :class:`_orm.Query`
           being available by using a :class:`_sql.Select` object with an
           :class:`_orm.Session`.

           See the notes for this change at :ref:`change_select_join`.

        .. seealso::

            :ref:`tutorial_select_join` - in the :doc:`/tutorial/index`

            :ref:`orm_queryguide_joins` - in the :ref:`queryguide_toplevel`

            :meth:`_expression.Select.join`

        R�R�R�(RcR3(R/RhR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s#cCs|j|d�j�S(sGCompute the final displayed list of :class:`_expression.FromClause`
        elements.

        This method will run through the full computation required to
        determine what FROM elements will be displayed in the resulting
        SELECT statement, including shadowing individual tables with
        JOIN objects, as well as full computation for ORM use cases including
        eager loading clauses.

        For ORM use, this accessor returns the **post compilation**
        list of FROM objects; this collection will include elements such as
        eagerly loaded tables and joins.  The objects will **not** be
        ORM enabled and not work as a replacement for the
        :meth:`_sql.Select.select_froms` collection; additionally, the
        method is not well performing for an ORM enabled statement as it
        will incur the full ORM construction process.

        To retrieve the FROM list that's implied by the "columns" collection
        passed to the :class:`_sql.Select` originally, use the
        :attr:`_sql.Select.columns_clause_froms` accessor.

        To select from an alternative set of columns while maintaining the
        FROM list, use the :meth:`_sql.Select.with_only_columns` method and
        pass the
        :paramref:`_sql.Select.with_only_columns.maintain_column_froms`
        parameter.

        .. versionadded:: 1.4.23 - the :meth:`_sql.Select.get_final_froms`
           method replaces the previous :attr:`_sql.Select.froms` accessor,
           which is deprecated.

        .. seealso::

            :attr:`_sql.Select.columns_clause_froms`

        N(t_compile_state_factoryRYR7(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytget_final_froms�s%s1.4.23sqThe :attr:`_expression.Select.froms` attribute is moved to the :meth:`_expression.Select.get_final_froms` method.cCs
|j�S(sYReturn the displayed list of :class:`_expression.FromClause`
        elements.


        (R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR
scCstj|�j|�S(s�Return the set of :class:`_expression.FromClause` objects implied
        by the columns clause of this SELECT statement.

        .. versionadded:: 1.4.23

        .. seealso::

            :attr:`_sql.Select.froms` - "final" FROM list taking the full
            statement into account

            :meth:`_sql.Select.with_only_columns` - makes use of this
            collection to set up a new FROM list

        (RR}R(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytcolumns_clause_fromsscCs
t|j�S(s0An iterator of all :class:`_expression.ColumnElement`
        expressions which would
        be rendered into the columns clause of the resulting SELECT statement.

        This method is legacy as of 1.4 and is superseded by the
        :attr:`_expression.Select.exported_columns` collection.

        (titerR?(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
inner_columns*scCsA||jkrtSx'|j�D]}|j|�r tSq WtS(N(R�R3RPR�RC(R/R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�7sc		sttjt|j�t|j�tg|jD]}|d^q.���}��fd�|D��g|jD]}�|��^qp}td��j�D��j	|�j	|�}t
|�t
|�|_�fd�}|�d<tt|�j
d�dd	��|j�dS(
Nics"i|]}�|��|�qS(((R�R�(R�Re(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys
<dictcomp>Ws	css$|]}t|t�r|VqdS(N(R�R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>\scs<t|t�r8|j�kr8�|jj|�}|SdS(N(R�R#R�RU(R�ReR�(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�esR�R�t
omit_attrsR(R(R�R�R�RRR,RRR�t
differenceRgR�R6R�R�(	R/R�ReR�R�R�texisting_from_objt	add_fromsR�((R�ReR�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�@s 	,
%		
cKs4tjtt|�jddddg�|j��S(NR�RR2R3(R�R�R�R6tget_childrenRP(R/R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�vscGsF|j�|jg|D]!}tjtj|d|�^q|_dS(s�Return a new :func:`_expression.select` construct with
        the given column expressions added to its columns clause.

        E.g.::

            my_select = my_select.add_columns(table.c.new_column)

        See the documentation for
        :meth:`_expression.Select.with_only_columns`
        for guidelines on adding /replacing the columns of a
        :class:`_expression.Select` object.

        RN(R�RRRhRR(R/R�RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR~s
cCs>gtj|�D]!}tjtj|d|�^q|_dS(NR(R+R~RRhRRR(R/RiRq((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
_set_entities�ss1.4s�The :meth:`_expression.Select.column` method is deprecated and will be removed in a future release.  Please use :meth:`_expression.Select.add_columns`cCs
|j|�S(s�Return a new :func:`_expression.select` construct with
        the given column expression added to its columns clause.

        E.g.::

            my_select = my_select.column(table.c.new_column)

        See the documentation for
        :meth:`_expression.Select.with_only_columns`
        for guidelines on adding /replacing the columns of a
        :class:`_expression.Select` object.

        (R(R/RH((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRH�sssqlalchemy.sql.utilcCs2|jtjjj|jd||j|j��S(s"Return a new :func:`_expression.select` construct with redundantly
        named, equivalently-valued columns removed from the columns clause.

        "Redundant" here means two columns where one refers to the
        other either based on foreign key, or via a simple equality
        comparison in the WHERE clause of the statement.   The primary purpose
        of this method is to automatically construct a select statement
        with all uniquely-named columns, without the need to use
        table-qualified labels as
        :meth:`_expression.Select.set_label_style`
        does.

        When columns are omitted based on foreign key, the referred-to
        column is the one that's kept.  When columns are omitted based on
        WHERE equivalence, the first column in the columns clause is the
        one that's kept.

        :param only_synonyms: when True, limit the removal of columns
         to those which have the same name as the equivalent.   Otherwise,
         all columns that are equivalent to another are removed.

        t
only_synonyms(twith_only_columnsR+RORPR�R?R,R(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
	cOs�|j�|jdt�}|rAtddj|�f��n|r`|jj||j�ntj	|�gt
jdd|�D]}t
jt
j|�^q�|_dS(s�Return a new :func:`_expression.select` construct with its columns
        clause replaced with the given columns.

        By default, this method is exactly equivalent to as if the original
        :func:`_expression.select` had been called with the given columns
        clause. E.g. a statement::

            s = select(table1.c.a, table1.c.b)
            s = s.with_only_columns(table1.c.b)

        should be exactly equivalent to::

            s = select(table1.c.b)

        In this mode of operation, :meth:`_sql.Select.with_only_columns`
        will also dynamically alter the FROM clause of the
        statement if it is not explicitly stated.
        To maintain the existing set of FROMs including those implied by the
        current columns clause, add the
        :paramref:`_sql.Select.with_only_columns.maintain_column_froms`
        parameter::

            s = select(table1.c.a, table2.c.b)
            s = s.with_only_columns(table1.c.a, maintain_column_froms=True)

        The above parameter performs a transfer of the effective FROMs
        in the columns collection to the :meth:`_sql.Select.select_from`
        method, as though the following were invoked::

            s = select(table1.c.a, table2.c.b)
            s = s.select_from(table1, table2).with_only_columns(table1.c.a)

        The :paramref:`_sql.Select.with_only_columns.maintain_column_froms`
        parameter makes use of the :attr:`_sql.Select.columns_clause_froms`
        collection and performs an operation equivalent to the following::

            s = select(table1.c.a, table2.c.b)
            s = s.select_from(*s.columns_clause_froms).with_only_columns(table1.c.a)

        :param \*columns: column expressions to be used.

         .. versionchanged:: 1.4 the :meth:`_sql.Select.with_only_columns`
            method accepts the list of column expressions positionally;
            passing the expressions as a list is deprecated.

        :param maintain_column_froms: boolean parameter that will ensure the
         FROM list implied from the current columns clause will be transferred
         to the :meth:`_sql.Select.select_from` method first.

         .. versionadded:: 1.4.23

        tmaintain_column_fromssunknown parameters: %ss, R�sSelect.with_only_columnsN(t_assert_no_memoizationsRaRCRnRcRR�R�RUR^Rt!_expression_collection_was_a_listRhRRR(R/R�ReR�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s:

cCstj|j�S(sReturn the completed WHERE clause for this
        :class:`_expression.Select` statement.

        This assembles the current collection of WHERE criteria
        into a single :class:`_expression.BooleanClauseList` construct.


        .. versionadded:: 1.4

        (R t_construct_for_whereclauseR,(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�!s
cGsTt|jt�st�x5|D]-}tjtj|�}|j|f7_qWdS(s�Return a new :func:`_expression.select` construct with
        the given expression added to
        its WHERE clause, joined to the existing clause via AND, if any.

        N(R�R,RgR�RRhRtWhereHavingRole(R/R�t	criteriontwhere_criteria((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR4s
cCs%|jtjtj|�f7_dS(s�Return a new :func:`_expression.select` construct with
        the given expression added to
        its HAVING clause, joined to the existing clause via AND, if any.

        N(RcRRhRR�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRBscGs?|r2t|_|jtd�|D��|_n	t|_dS(s�Return a new :func:`_expression.select` construct which
        will apply DISTINCT to its columns clause.

        :param \*expr: optional column expressions.  When present,
         the PostgreSQL dialect will render a ``DISTINCT ON (<expressions>>)``
         construct.

         .. deprecated:: 1.4 Using \*expr in other dialects is deprecated
            and will raise :class:`_exc.CompileError` in a future version.

        css$|]}tjtj|�VqdS(N(RRhRtByOfRole(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>]sN(R3RdReRg(R/R^((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRmMs

		cs)�jt�fd�|D��7_dS(sReturn a new :func:`_expression.select` construct with the
        given FROM expression(s)
        merged into its list of FROM objects.

        E.g.::

            table1 = table('t1', column('a'))
            table2 = table('t2', column('b'))
            s = select(table1.c.a).\
                select_from(
                    table1.join(table2, table1.c.a==table2.c.b)
                )

        The "from" list is a unique set on the identity of each element,
        so adding an already present :class:`_schema.Table`
        or other selectable
        will have no effect.   Passing a :class:`_expression.Join` that refers
        to an already present :class:`_schema.Table`
        or other selectable will have
        the effect of concealing the presence of that selectable as
        an individual element in the rendered FROM list, instead
        rendering it into a JOIN clause.

        While the typical purpose of :meth:`_expression.Select.select_from`
        is to
        replace the default, derived FROM clause with a join, it can
        also be called with individual table elements, multiple times
        if desired, in the case that the FROM clause cannot be fully
        derived from the columns clause::

            select(func.count('*')).select_from(table1)

        c3s*|] }tjtj|d��VqdS(RN(RRhRR}(R�R�(R/(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�sN(RRg(R/R
((R/sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRbs$
cGsUt|_|r1|ddthkr1d|_n |jtd�|D��|_dS(sXReturn a new :class:`_expression.Select`
        which will correlate the given FROM
        clauses to that of an enclosing :class:`_expression.Select`.

        Calling this method turns off the :class:`_expression.Select` object's
        default behavior of "auto-correlation".  Normally, FROM elements
        which appear in a :class:`_expression.Select`
        that encloses this one via
        its :term:`WHERE clause`, ORDER BY, HAVING or
        :term:`columns clause` will be omitted from this
        :class:`_expression.Select`
        object's :term:`FROM clause`.
        Setting an explicit correlation collection using the
        :meth:`_expression.Select.correlate`
        method provides a fixed list of FROM objects
        that can potentially take place in this process.

        When :meth:`_expression.Select.correlate`
        is used to apply specific FROM clauses
        for correlation, the FROM elements become candidates for
        correlation regardless of how deeply nested this
        :class:`_expression.Select`
        object is, relative to an enclosing :class:`_expression.Select`
        which refers to
        the same FROM object.  This is in contrast to the behavior of
        "auto-correlation" which only correlates to an immediate enclosing
        :class:`_expression.Select`.
        Multi-level correlation ensures that the link
        between enclosed and enclosing :class:`_expression.Select`
        is always via
        at least one WHERE/ORDER BY/HAVING/columns clause in order for
        correlation to take place.

        If ``None`` is passed, the :class:`_expression.Select`
        object will correlate
        none of its FROM entries, and all will render unconditionally
        in the local FROM clause.

        :param \*fromclauses: a list of one or more
         :class:`_expression.FromClause`
         constructs, or other compatible constructs (i.e. ORM-mapped
         classes) to become part of the correlate collection.

        .. seealso::

            :meth:`_expression.Select.correlate_except`

            :ref:`tutorial_scalar_subquery`

        icss$|]}tjtj|�VqdS(N(RRhRR}(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�sN((RCR�RYR2Rg(R/tfromclauses((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR
�s
5		cGs[t|_|r1|ddthkr1d|_n&|jp=dtd�|D��|_dS(s�Return a new :class:`_expression.Select`
        which will omit the given FROM
        clauses from the auto-correlation process.

        Calling :meth:`_expression.Select.correlate_except` turns off the
        :class:`_expression.Select` object's default behavior of
        "auto-correlation" for the given FROM elements.  An element
        specified here will unconditionally appear in the FROM list, while
        all other FROM elements remain subject to normal auto-correlation
        behaviors.

        If ``None`` is passed, the :class:`_expression.Select`
        object will correlate
        all of its FROM entries.

        :param \*fromclauses: a list of one or more
         :class:`_expression.FromClause`
         constructs, or other compatible constructs (i.e. ORM-mapped
         classes) to become part of the correlate-exception collection.

        .. seealso::

            :meth:`_expression.Select.correlate`

            :ref:`tutorial_scalar_subquery`

        icss$|]}tjtj|�VqdS(N(RRhRR}(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�sN(((RCR�RYR3Rg(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytcorrelate_except�s
	cCsMtj|j�}tg|jD]!}|js||�|f^q�j�S(s-A :class:`_expression.ColumnCollection`
        representing the columns that
        this SELECT statement or similar construct returns in its result set,
        not including :class:`_sql.TextClause` constructs.

        This collection differs from the :attr:`_expression.FromClause.columns`
        collection of a :class:`_expression.FromClause` in that the columns
        within this collection cannot be directly nested inside another SELECT
        statement; a subquery must be applied first which provides for the
        necessary parenthesization required by SQL.

        For a :func:`_expression.select` construct, the collection here is
        exactly what would be rendered inside the "SELECT" statement, and the
        :class:`_expression.ColumnElement` objects are directly present as they
        were given, e.g.::

            col1 = column('q', Integer)
            col2 = column('p', Integer)
            stmt = select(col1, col2)

        Above, ``stmt.selected_columns`` would be a collection that contains
        the ``col1`` and ``col2`` objects directly. For a statement that is
        against a :class:`_schema.Table` or other
        :class:`_expression.FromClause`, the collection will use the
        :class:`_expression.ColumnElement` objects that are in the
        :attr:`_expression.FromClause.c` collection of the from element.

        .. note::

            The :attr:`_sql.Select.selected_columns` collection does not
            include expressions established in the columns clause using the
            :func:`_sql.text` construct; these are silently omitted from the
            collection. To use plain textual column expressions inside of a
            :class:`_sql.Select` construct, use the :func:`_sql.literal_column`
            construct.


        .. versionadded:: 1.4

        (RR*R�RR?R R�(R/tconvR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
/
cCs"tj|�j}t||��S(N(RR}RCR�(R/R~((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR?)scCs%|jtkr!|jt�}n|S(N(R�R�RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�.scCs�|dkr|j}ntj|j�}i}g}|j}|jtk}|jtk}d}	x�|D]�}
t}|
j	s�d}}
}n�|r�d}}
|
j
p�|
j}n�|r�|
j}
}}n|
j
}}d}
|dkr�|
j
}|dkry|
j|k}|
||
j<d}}
|rm|rQ|
j|	�}|	d7}	qv|
j|	�}|	d7}	q�|
j}q�|}
}}n|dk	r�||kr�t||�t|
�krn|r�|
j}
}n
|
j}
}|ra|
|krat||
�t|
�kst�|r;|
j|	�}
}|	d7}	n|
j|	�}
}|	d7}	t}q�|
||
<q�|r�|r�|
j|	�}
}|	d7}	n|
j|	�}
}|	d7}	t}q�q�|
||<n||
||
�||
|f�qjW|S(scGenerate column names as rendered in a SELECT statement by
        the compiler.

        This is distinct from the _column_naming_convention generator that's
        intended for population of .c collections and similar, which has
        different rules.   the collection returned here calls upon the
        _column_naming_convention as well.

        iN(RYR?RR*R�RR�R�RCt_render_label_in_columns_clauset_non_anon_labelt_anon_name_labelR9t_expression_labelt_dedupe_anon_tq_label_idxt_dedupe_anon_label_idxR�t_anon_tq_labelR�R3(R/R�Rztkey_naming_conventionR&tresultt
result_appendR(tlabel_style_nonetdedupe_hashR�trepeatedteffective_nametrequired_label_nametfallback_label_namet
expr_label((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�3s�	
	

	


	

"

	



	c
Csig|jt�D]?\}}}}}|js|j|d|d|dt�^q}|jj|�dS(sYGenerate column proxies to place in the exported ``.c``
        collection of a subquery.R�RLtname_is_truncatableN(R�RCR R�R3R�R�(R/R8R�t	proxy_keyR�R�R�tprox((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s"0cCs|jpt|jj�S(N(R�R�R�R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_needs_parens_for_grouping�scCs.t|t�r |j�r |St|�SdS(s@Return a 'grouping' construct as per the
        :class:`_expression.ClauseElement` specification.

        This produces an element that can be embedded in an expression. Note
        that this method is called automatically as needed when constructing
        expressions and should not require explicit use.

        N(R�R�R�R�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s

cOstj|||�S(s�Return a SQL ``UNION`` of this select() construct against
        the given selectables provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR|scOstj|||�S(s�Return a SQL ``UNION ALL`` of this select() construct against
        the given selectables provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRJscOstj|||�S(s�Return a SQL ``EXCEPT`` of this select() construct against
        the given selectable provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pytexcept_(scOstj|||�S(s�Return a SQL ``EXCEPT ALL`` of this select() construct against
        the given selectables provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
except_all9scOstj|||�S(s�Return a SQL ``INTERSECT`` of this select() construct against
        the given selectables provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt	intersectJscOstj|||�S(s�Return a SQL ``INTERSECT ALL`` of this select() construct
        against the given selectables provided as positional arguments.

        :param \*other: one or more elements with which to create a
         UNION.

         .. versionchanged:: 1.4.28

            multiple elements are now accepted.

        :param \**kwargs: keyword arguments are forwarded to the constructor
         for the newly created :class:`_sql.CompoundSelect` object.

        (R�R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt
intersect_all[ss:attr:`.Executable.bind`R	s5Bound metadata is being removed as of SQLAlchemy 2.0.R
cCs�|jr|jSx[|j�D]M}|jrM|j|krMtjd��n|j}|ri||_|SPqWx-|jD]"}|j}|rx||_|SqxWdS(s�Returns the :class:`_engine.Engine` or :class:`_engine.Connection`
        to which this :class:`.Executable` is bound, or None if none found.

        s-select() construct refers to itself as a FROMN(R�RPR]RR*R-RR(R/R0R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyRls 					cCs
||_dS(N(R�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s(kR1R2RARWRRWRRCRdReR2RYR3R,RcRR3R�RRRfR)RPtdp_memoized_select_entitiestdp_clauseelement_tupleR_RR�Rtdp_plain_objRLRQR\RmRnRsRtR�RR�Rt_executable_traverse_internalsRtdp_has_cache_keyRRR�R+RZR7RrRgRsRyR�R�R|R�R�R5R�RRRcR�R�R�R�R
R�R�R�R	R�R�RR�RHR[R�R�R�t_whereclauseRRRmRR
R�RR;R�R?R�R�R�R�R�R|RJR�R�R�R�RRR(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR6�s�	 ��3
:					
,	C<%	'
		6		M+=&9	�								R�cBszeZdZgZeZeZeZd�Z	e
d��ZeZe
d��Zd�Ze
d��Ze
d��ZRS(s�Represent a scalar subquery.


    A :class:`_sql.ScalarSelect` is created by invoking the
    :meth:`_sql.SelectBase.scalar_subquery` method.   The object
    then participates in other SQL expressions as a SQL column expression
    within the :class:`_sql.ColumnElement` hierarchy.

    .. seealso::

        :meth:`_sql.SelectBase.scalar_subquery`

        :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial

    cCs||_|j�|_dS(N(RR�R�(R/R((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s	cCstjd��dS(NscScalar Select expression has no columns; use this object directly within a column-level expression.(R*R-(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs|jj|�|_dS(suApply a WHERE clause to the SELECT statement referred to
        by this :class:`_expression.ScalarSelect`.

        N(RR(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scKs|S(N((R/R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scGs|jj|�|_dS(s�Return a new :class:`_expression.ScalarSelect`
        which will correlate the given FROM
        clauses to that of an enclosing :class:`_expression.Select`.

        This method is mirrored from the :meth:`_sql.Select.correlate` method
        of the underlying :class:`_sql.Select`.  The method applies the
        :meth:_sql.Select.correlate` method, then returns a new
        :class:`_sql.ScalarSelect` against that statement.

        .. versionadded:: 1.4 Previously, the
           :meth:`_sql.ScalarSelect.correlate`
           method was only available from :class:`_sql.Select`.

        :param \*fromclauses: a list of one or more
         :class:`_expression.FromClause`
         constructs, or other compatible constructs (i.e. ORM-mapped
         classes) to become part of the correlate collection.

        .. seealso::

            :meth:`_expression.ScalarSelect.correlate_except`

            :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial


        N(RR
(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR
�scGs|jj|�|_dS(s�Return a new :class:`_expression.ScalarSelect`
        which will omit the given FROM
        clauses from the auto-correlation process.

        This method is mirrored from the
        :meth:`_sql.Select.correlate_except` method of the underlying
        :class:`_sql.Select`.  The method applies the
        :meth:_sql.Select.correlate_except` method, then returns a new
        :class:`_sql.ScalarSelect` against that statement.

        .. versionadded:: 1.4 Previously, the
           :meth:`_sql.ScalarSelect.correlate_except`
           method was only available from :class:`_sql.Select`.

        :param \*fromclauses: a list of one or more
         :class:`_expression.FromClause`
         constructs, or other compatible constructs (i.e. ORM-mapped
         classes) to become part of the correlate-exception collection.

        .. seealso::

            :meth:`_expression.ScalarSelect.correlate`

            :ref:`tutorial_scalar_subquery` - in the 2.0 tutorial


        N(RR�(R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s(R1R2RARR3R+RCt_is_implicitly_booleanR4R�R5R�R�RRR�R
R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s		R�cBsteZdZgZeZd�Zd�Zej	dd
dd�dd��Zd	�Zd
�Z
d�Zd�ZRS(s�Represent an ``EXISTS`` clause.

    See :func:`_sql.exists` for a description of usage.

    An ``EXISTS`` clause can also be constructed from a :func:`_sql.select`
    instance by calling :meth:`_sql.SelectBase.exists`.

    c	Os�|r,t|dttf�r,|d}n0|sDtd�f}ntj||�j�}tj||dt	j
dtjdt
�dS(s�Construct a new :class:`_expression.Exists` construct.

        The :func:`_sql.exists` can be invoked by itself to produce an
        :class:`_sql.Exists` construct, which will accept simple WHERE
        criteria::

            exists_criteria = exists().where(table1.c.col1 == table2.c.col2)

        However, for greater flexibility in constructing the SELECT, an
        existing :class:`_sql.Select` construct may be converted to an
        :class:`_sql.Exists`, most conveniently by making use of the
        :meth:`_sql.SelectBase.exists` method::

            exists_criteria = (
                select(table2.c.col2).
                where(table1.c.col1 == table2.c.col2).
                exists()
            )

        The EXISTS criteria is then used inside of an enclosing SELECT::

            stmt = select(table1.c.col1).where(exists_criteria)

        The above statement will then be of the form::

            SELECT col1 FROM table1 WHERE EXISTS
            (SELECT table2.col2 FROM table2 WHERE table2.col2 = table1.col1)

        .. seealso::

            :ref:`tutorial_exists` - in the :term:`2.0 style` tutorial.

            :meth:`_sql.SelectBase.exists` - method to transform a ``SELECT`` to an
            ``EXISTS`` clause.

        iRwtoperatorR�twraps_column_expressionN(R�R�R�R&R6RyRTR(R�RR�RtBOOLEANTYPER3(R/R:R;R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�
s%
		cCs.|jj�}||�}|jdtj�S(NR�(Rt_ungroupR�RR�(R/tfnR((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt_regroupAsR�s2.0s�The :paramref:`_sql.Exists.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.R;s�The :meth:`_sql.Exists.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.cKs/|dk	r||d<ntj||g|�S(s�Return a SELECT of this :class:`_expression.Exists`.

        e.g.::

            stmt = exists(some_table.c.id).where(some_table.c.id == 5).select()

        This will produce a statement resembling::

            SELECT EXISTS (SELECT id FROM some_table WHERE some_table = :param) AS anon_1

        :param whereclause: a WHERE clause, equivalent to calling the
         :meth:`_sql.Select.where` method.

        :param **kwargs: additional keyword arguments are passed to the
         legacy constructor for :class:`_sql.Select` described at
         :meth:`_sql.Select.create_legacy_select`.

        .. seealso::

            :func:`_expression.select` - general purpose
            method which allows for arbitrary column lists.

        R�N(RYR6R�(R/R�R;((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�Fs+
cs+|j�}|j�fd��|_|S(s�Apply correlation to the subquery noted by this
        :class:`_sql.Exists`.

        .. seealso::

            :meth:`_sql.ScalarSelect.correlate`

        cs
|j��S(N(R
(R(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��R�(R	R�R(R/R�R�((R�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR
us	cs+|j�}|j�fd��|_|S(s�Apply correlation to the subquery noted by this
        :class:`_sql.Exists`.

        .. seealso::

            :meth:`_sql.ScalarSelect.correlate_except`

        cs
|j��S(N(R�(R(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��R�(R	R�R(R/R�R�((R�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s
cs+|j�}|j�fd��|_|S(s�Return a new :class:`_expression.Exists` construct,
        applying the given
        expression to the :meth:`_expression.Select.select_from`
        method of the select
        statement contained.

        .. note:: it is typically preferable to build a :class:`_sql.Select`
           statement first, including the desired WHERE clause, then use the
           :meth:`_sql.SelectBase.exists` method to produce an
           :class:`_sql.Exists` object at once.

        cs
|j��S(N(R(R(R
(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��R�(R	R�R(R/R
R�((R
sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s
cs+|j�}|j�fd��|_|S(s�Return a new :func:`_expression.exists` construct with the
        given expression added to
        its WHERE clause, joined to the existing clause via AND, if any.


        .. note:: it is typically preferable to build a :class:`_sql.Select`
           statement first, including the desired WHERE clause, then use the
           :meth:`_sql.SelectBase.exists` method to produce an
           :class:`_sql.Exists` object at once.

        cs
|j��S(N(R(R(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��R�(R	R�R(R/R�R�((R�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s(s2.0s�The :paramref:`_sql.Exists.select().whereclause` parameter is deprecated and will be removed in version 2.0.  Please make use of the :meth:`.Select.where` method to add WHERE criteria to the SELECT statement.(s2.0s�The :meth:`_sql.Exists.select` method will no longer accept keyword arguments in version 2.0.  Please use generative methods from the :class:`_sql.Select` construct in order to apply additional modifications.N(R1R2RARR3R4R�R�R+R�RYR�R
R�RR(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s	4					t
TextualSelectcBs�eZdZdZeZdejfdejfge	j
ZeZ
eZeZed�Zejd��Zed��Zd�Zd�Zed	��Zed
��Zd�Zd�ZRS(
sFWrap a :class:`_expression.TextClause` construct within a
    :class:`_expression.SelectBase`
    interface.

    This allows the :class:`_expression.TextClause` object to gain a
    ``.c`` collection
    and other FROM-like capabilities such as
    :meth:`_expression.FromClause.alias`,
    :meth:`_expression.SelectBase.cte`, etc.

    The :class:`_expression.TextualSelect` construct is produced via the
    :meth:`_expression.TextClause.columns`
    method - see that method for details.

    .. versionchanged:: 1.4 the :class:`_expression.TextualSelect`
       class was renamed
       from ``TextAsFrom``, to more correctly suit its role as a
       SELECT-oriented object and not a FROM clause.

    .. seealso::

        :func:`_expression.text`

        :meth:`_expression.TextClause.columns` - primary creation interface.

    ttextual_selectRtcolumn_argscCsA||_g|D]}tjtj|�^q|_||_dS(N(RRRhRRR�t
positional(R/RyR�R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s	+cCstd�|jD��j�S(smA :class:`_expression.ColumnCollection`
        representing the columns that
        this SELECT statement or similar construct returns in its result set,
        not including :class:`_sql.TextClause` constructs.

        This collection differs from the :attr:`_expression.FromClause.columns`
        collection of a :class:`_expression.FromClause` in that the columns
        within this collection cannot be directly nested inside another SELECT
        statement; a subquery must be applied first which provides for the
        necessary parenthesization required by SQL.

        For a :class:`_expression.TextualSelect` construct, the collection
        contains the :class:`_expression.ColumnElement` objects that were
        passed to the constructor, typically via the
        :meth:`_expression.TextClause.columns` method.


        .. versionadded:: 1.4

        css|]}|j|fVqdS(N(R�(R�R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>�s(RR�R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��scCs|jS(N(R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR?scCs|S(N((R/R�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scCs|S(N((R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�	scCs
|jjS(N(RR�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scOs|jj||�|_dS(N(Rt
bindparams(R/tbindstbind_as_values((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�scs'�jj�fd�|jD��dS(Nc3s|]}|j��VqdS(N(R�(R�R�(R�(sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pys	<genexpr>s(R�R�R�(R/R�((R�sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s	cCs|jdjS(Ni(R�R�(R/((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�s(R1R2RARWR�R�R)RRPRR�RR3t_is_textualtis_textR�RCR�RR;R�R5R?R�R�R�RR�R�R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR��s$
			tAnnotatedFromClausecBseZd�ZRS(cCs|jtj|||�dS(N(R�RR�(R/RR�((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�"s(R1R2R�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyR�!s(qRAR�R�R�RR�RRRRRRt
annotationRRtbaseR	R
RRR
RRRRRRRRRRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+t
inspectionR,R-RZR8R!R<RGtobjectR\RnRttAnonymizedFromClauseRoleR�RR�R�R�R�tDMLTableRoleR�RRR�R/RJR�RNRCRIRLRRR�RaRsR�RSt
DMLSelectRoleR�t
InElementRoleR�R�R�R�t
plugin_forR�R�Rt
MemoizedSlotsRRStHasCacheKeytHasCopyInternalstTraversibleRUR6R�R�R�t
TextAsFromR�(((sJ/opt/alt/python27/lib/python2.7/site-packages/sqlalchemy/sql/selectable.pyt<module>s?N83T��				��P[J�3U��DI/�=��M5��
�#���")�������n�g