%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyo

�
��4]c@s�ddlmZddlmZddlmZddlmZddlmZdejfd��YZ	d	efd
��YZ
d�ZdS(
i(tARRAYi(telements(t
expression(t	functions(tColumnCollectionConstrainttaggregate_order_bycBsPeZdZdZd�Zdd�Zd�Zej	d�Z
ed��ZRS(s�Represent a PostgreSQL aggregate order by expression.

    E.g.::

        from sqlalchemy.dialects.postgresql import aggregate_order_by
        expr = func.array_agg(aggregate_order_by(table.c.a, table.c.b.desc()))
        stmt = select([expr])

    would represent the expression::

        SELECT array_agg(a ORDER BY b DESC) FROM table;

    Similarly::

        expr = func.string_agg(
            table.c.a,
            aggregate_order_by(literal_column("','"), table.c.a)
        )
        stmt = select([expr])

    Would represent::

        SELECT string_agg(a, ',' ORDER BY a) FROM table;

    .. versionadded:: 1.1

    .. versionchanged:: 1.2.13 - the ORDER BY argument may be multiple terms

    .. seealso::

        :class:`.array_agg`

    RcGs}tj|�|_t|�}|dkr9td��n@|dkr^tj|d�|_ntjdtj|�|_dS(Nis)at least one ORDER BY element is requiredit_literal_as_text(Rt_literal_as_bindsttargettlent	TypeErrortorder_byt
ClauseList(tselfRRt_lob((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyt__init__4s	cCs|S(N((R
tagainst((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyt
self_groupAscKs|j|jfS(N(RR(R
tkwargs((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pytget_childrenDscKs.||j|�|_||j|�|_dS(N(RR(R
tclonetkw((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyt_copy_internalsGscCs|jj|jjS(N(Rt
_from_objectsR(R
((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyRKsN(
t__name__t
__module__t__doc__t__visit_name__RtNoneRRRt_cloneRtpropertyR(((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyRs!	
	tExcludeConstraintcBsAeZdZdZdZejddd�d��Zd�Z	RS(s�A table-level EXCLUDE constraint.

    Defines an EXCLUDE constraint as described in the `postgres
    documentation`__.

    __ http://www.postgresql.org/docs/9.0/static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE

    texclude_constrainttwheres:class:`.ExcludeConstraint`s$:paramref:`.ExcludeConstraint.where`c	Osig}g}i|_t|�\}}x�t|j|�|�D]�\\}}}	}
}|
dk	rt|j|
�n|dk	r�|jn|	}|dk	r�||j|<ntj|�}|j|||f�q@W||_t	j
|d|jd�d|jd�d|jd�|�|jdd�|_|jd�}
|
dk	retj
|
dt�|_ndS(	s�
        Create an :class:`.ExcludeConstraint` object.

        E.g.::

            const = ExcludeConstraint(
                (Column('period'), '&&'),
                (Column('group'), '='),
                where=(Column('group') != 'some group')
            )

        The constraint is normally embedded into the :class:`.Table` construct
        directly, or added later using :meth:`.append_constraint`::

            some_table = Table(
                'some_table', metadata,
                Column('id', Integer, primary_key=True),
                Column('period', TSRANGE()),
                Column('group', String)
            )

            some_table.append_constraint(
                ExcludeConstraint(
                    (some_table.c.period, '&&'),
                    (some_table.c.group, '='),
                    where=some_table.c.group != 'some group',
                    name='some_table_excl_const'
                )
            )

        :param \*elements:

          A sequence of two tuples of the form ``(column, operator)`` where
          "column" is a SQL expression element or a raw SQL string, most
          typically a :class:`.Column` object, and "operator" is a string
          containing the operator to use.   In order to specify a column name
          when a  :class:`.Column` object is not available, while ensuring
          that any necessary quoting rules take effect, an ad-hoc
          :class:`.Column` or :func:`.sql.expression.column` object should be
          used.

        :param name:
          Optional, the in-database name of this constraint.

        :param deferrable:
          Optional bool.  If set, emit DEFERRABLE or NOT DEFERRABLE when
          issuing DDL for this constraint.

        :param initially:
          Optional string.  If set, emit INITIALLY <value> when issuing DDL
          for this constraint.

        :param using:
          Optional string.  If set, emit USING <index_method> when issuing DDL
          for this constraint. Defaults to 'gist'.

        :param where:
          Optional SQL expression construct or literal SQL string.
          If set, emit WHERE <predicate> when issuing DDL
          for this constraint.

        tnamet
deferrablet	initiallytusingtgistR!tallow_coercion_to_textN(t	operatorstzipt"_extract_col_expression_collectionRtappendR"Rt_literal_as_columnt
_render_exprsRRtgetR%RtTrueR!(R
RRtcolumnstrender_exprstexpressionsR(texprtcolumntstrnametadd_elementtoperatorR"R!((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyR^s0D	+	cKs�g|jj�D]}||j|f^q}|jd|jd|jd|jd|jd|j|�}|j	j
|j	�|S(NR"R#R$R!R%(R0tkeysR(t	__class__R"R#R$R!R%tdispatcht_update(R
RtcolRtc((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pytcopy�s/					N(
RRRRRR!Rt_document_text_coercionRR>(((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyRPsgcOst|d<tjj||�S(s�PostgreSQL-specific form of :class:`.array_agg`, ensures
    return type is :class:`.postgresql.ARRAY` and not
    the plain :class:`.types.ARRAY`, unless an explicit ``type_``
    is passed.

    .. versionadded:: 1.1

    t_default_array_type(RRtfunct	array_agg(targR((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyRB�s	
N(tarrayRtsqlRRRt
sql.schemaRt
ColumnElementRRRB(((sU/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/ext.pyt<module>sA�

Zerion Mini Shell 1.0