σ ΓΜ4]c@sŒddlmZddlmZddlmZddlmZddlmZdejfd„ƒYZ d efd „ƒYZ d „Z d S( i(tARRAYi(telements(t expression(t functions(tColumnCollectionConstrainttaggregate_order_bycBsPeZdZdZd„Zdd„Zd„Zej d„Z e d„ƒ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(tselfRR t_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| when issuing DDL for this constraint. :param using: Optional string. If set, emit USING when issuing DDL for this constraint. Defaults to 'gist'. :param where: Optional SQL expression construct or literal SQL string. If set, emit WHERE 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_exprst expressionsR(texprtcolumntstrnamet add_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|dsA†