U kf@sddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd l m Z erd d l m Z d d lmZd d lmZd dlmZd dlmZededZededdZGdddZGdddZGdddZGdddeZGdddeZGdd d eZGd!d"d"eZGd#d$d$eZGd%d&d&eZGd'd(d(eZGd)d*d*eZ Gd+d,d,e eZ!Gd-d.d.eeeZ"Gd/d0d0eeeZ#Gd1d2d2eZ$Gd3d4d4eZ%Gd5d6d6eee%Z&Gd7d8d8ee%Z'Gd9d:d:eZ(Gd;d<dd>ee(Z*Gd?d@d@e*Z+GdAdBdBe#eZ,GdCdDdDe,eZ-GdEdFdFe,eZ.GdGdHdHe,eZ/GdIdJdJeZ0GdKdLdLeee(Z1GdMdNdNe"e1Z2GdOdPdPe2Z3GdQdRdRe3Z4GdSdTdTeZ5GdUdVdVeZ6GdWdXdXe6e5Z7GdYdZdZe5Z8Gd[d\d\eZ9Gd]d^d^eeZ:Gd_d`d`e6Z;Gdadbdbe2ZGdgdhdhe6Z?Gdidjdje(Z@GdkdldleZAGdmdndneAZBdoS)p) annotations)Any)Generic)Optional) TYPE_CHECKING)TypeVar)util)Literal)_PropagateAttrsType)Label)_SelectIterable) FromClause)Subquery_T)bound_T_coT)r covariantc@seZdZdZdZdZdZdS)SQLRolezDefine a "role" within a SQL statement structure. Classes within SQL Core participate within SQLRole hierarchies in order to more accurately indicate where they may be used within SQL statements of all types. .. versionadded:: 1.4 FN)__name__ __module__ __qualname____doc__ __slots__ allows_lambdauses_inspectionrrrD/opt/hc_python/lib64/python3.8/site-packages/sqlalchemy/sql/roles.pyrs rc@s"eZdZUdZdZded<dZdS)UsesInspectionrNz Literal[None] _post_inspectT)rrrrr __annotations__rrrrrr-s  rc@seZdZdZdZdS)AllowsLambdaRolerTN)rrrrrrrrrr"3sr"c@seZdZdZdZdS)HasCacheKeyRolerzCacheable Core or ORM objectNrrrr _role_namerrrrr#8sr#c@seZdZdZdZdS)ExecutableOptionRolerz"ExecutionOption Core or ORM objectNr$rrrrr&=sr&c@seZdZdZdZdS)LiteralValueRolerzLiteral Python valueNr$rrrrr'Bsr'c@seZdZdZdZdS)ColumnArgumentRolerzColumn expressionNr$rrrrr(Gsr(c@seZdZdZdZdS)ColumnArgumentOrKeyRolerColumn expression or string keyNr$rrrrr)Lsr)c@seZdZdZdZdS)StrAsPlainColumnRolerr*Nr$rrrrr+Qsr+c@seZdZdZdZdS)ColumnListRolezCElements suitable for forming comma separated lists of expressions.rNrrrrrrrrrr,Vsr,c@seZdZdZdZdS) StringRolez/mixin indicating a role that results in stringsrNr-rrrrr.\sr.c@seZdZdZdZdS)TruncatedLabelRolerzString SQL identifierNr$rrrrr/bsr/c@s&eZdZdZdZeddddZdS)ColumnsClauseRolerz?Column expression, FROM clause, or other columns clause elementrreturncCs tdSNNotImplementedErrorselfrrr_select_iterablemsz"ColumnsClauseRole._select_iterableN)rrrrr%propertyr8rrrrr0gs r0c@seZdZdZdZdS)TypedColumnsClauseRolez'element-typed form of ColumnsClauseRolerNr-rrrrr:rsr:c@seZdZdZdZdS)LimitOffsetRolerzLIMIT / OFFSET expressionNr$rrrrr;xsr;c@seZdZdZdZdS)ByOfRolerzGROUP BY / OF / etc. expressionNr$rrrrr<}sr<c@seZdZdZdZdS) GroupByRolerzGROUP BY expressionNr$rrrrr=sr=c@seZdZdZdZdS) OrderByRolerzORDER BY expressionNr$rrrrr>sr>c@seZdZdZdS)StructuralRolerNrrrrrrrrr?sr?c@seZdZdZdZdS)StatementOptionRolerz statement sub-expression elementNr$rrrrrAsrAc@seZdZdZdZdS) OnClauseRolerzCON clause, typically a SQL expression or ORM relationship attributeNr$rrrrrBsrBc@seZdZdZdZdS)WhereHavingRolerz$SQL expression for WHERE/HAVING roleNr$rrrrrCsrCc@s$eZdZdZdZdddddZdS) ExpressionElementRolerzSQL expression element Optional[str]z Label[_T])namer2cCs tdSr3r4)r7rFrrrlabelszExpressionElementRole.labelN)rrrrr%rGrrrrrDsrDc@seZdZdZdZdS) ConstExprRolerz#Constant True/False/None expressionNr$rrrrrHsrHc@seZdZdZdS)LabeledColumnExprRolerNr@rrrrrIsrIc@seZdZdZdZdS)BinaryElementRolerz'SQL expression element or literal valueNr$rrrrrJsrJc@seZdZdZdZdS) InElementRolerz?IN expression list, SELECT construct, or bound parameter objectNr$rrrrrKsrKc@seZdZdZdZdS)JoinTargetRolerzGJoin target, typically a FROM expression, or ORM relationship attributeNr$rrrrrLsrLc@s"eZdZUdZdZdZded<dS)FromClauseRolerz2FROM expression, such as a Table or alias() objectFboolZnamed_with_columnN)rrrrr%Z _is_subqueryr!rrrrrMs rMc@seZdZdZdS)StrictFromClauseRolerNr@rrrrrOsrOc@s.eZdZdZer*dddddddd d ZdS) AnonymizedFromClauseRolerNF)rFflatrErNr)rFrQr2cCsdSr3r)r7rFrQrrr_anonymous_fromclausesz.AnonymizedFromClauseRole._anonymous_fromclause)rrrrrrRrrrrrPs rPc@seZdZdZdZdS)ReturnsRowsRolerzcRow returning expression such as a SELECT, a FROM clause, or an INSERT/UPDATE/DELETE with RETURNINGNr$rrrrrSsrSc@s4eZdZdZdZer*ejddddZnej ZdS) StatementRolerz"Executable SQL or text() constructr r1cCsdSr3rr6rrr_propagate_attrsszStatementRole._propagate_attrsN) rrrrr%rr Zmemoized_propertyrU EMPTY_DICTrrrrrTs rTc@s"eZdZdZdZddddZdS)SelectStatementRolerz/SELECT construct or equivalent text() constructrr1cCs tddS)NzFAll SelectStatementRole objects should implement a .subquery() method.r4r6rrrsubqueryszSelectStatementRole.subqueryN)rrrrr%rXrrrrrWsrWc@seZdZdZdS) HasCTERolerNr@rrrrrY srYc@seZdZdZdZdS) IsCTERolerz CTE objectNr$rrrrrZ srZc@seZdZdZdZdZdS)CompoundElementRolezDSELECT statements inside a CompoundSelect, e.g. UNION, EXTRACT, etc.rz@SELECT construct for inclusion in a UNION or other set constructNrrrrrr%rrrrr[sr[c@seZdZdZdS)DMLRolerNr@rrrrr]sr]c@seZdZdZdZdS) DMLTableRolerz-subject table for an INSERT, UPDATE or DELETENr$rrrrr^ sr^c@seZdZdZdZdS) DMLColumnRolerz*SET/VALUES column expression or string keyNr$rrrrr_%sr_c@seZdZdZdZdZdS) DMLSelectRolez@A SELECT statement embedded in DML, typically INSERT from SELECTrz-SELECT statement or equivalent textual objectNr\rrrrr`*sr`c@seZdZdZdS)DDLRolerNr@rrrrra1srac@seZdZdZdZdS)DDLExpressionRolerz)SQL expression element for DDL constraintNr$rrrrrb5srbc@seZdZdZdZdS)DDLConstraintColumnRolerz:String column name or column expression for DDL constraintNr$rrrrrc:srcc@seZdZdZdZdS)DDLReferredColumnRolerzBString column name or Column object for DDL foreign key constraintNr$rrrrrd?srdN)C __future__rtypingrrrrrr Z util.typingr Z_typingr elementsr Z selectablerrrrrrrr"r#r&r'r(r)r+r,r.r/r0r:r;r<r=r>r?rArBrCrDrHrIrJrKrLrMrOrPrSrTrWrYrZr[r]r^r_r`rarbrcrdrrrrsx