summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/roles.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/roles.py')
-rw-r--r--lib/sqlalchemy/sql/roles.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/roles.py b/lib/sqlalchemy/sql/roles.py
index 787a1c25e..b41ef7a5d 100644
--- a/lib/sqlalchemy/sql/roles.py
+++ b/lib/sqlalchemy/sql/roles.py
@@ -4,10 +4,17 @@
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
+import typing
+from sqlalchemy.util.langhelpers import TypingOnly
from .. import util
+if typing.TYPE_CHECKING:
+ from .elements import ClauseElement
+ from .selectable import FromClause
+
+
class SQLRole:
"""Define a "role" within a SQL statement structure.
@@ -284,3 +291,25 @@ class DDLReferredColumnRole(DDLConstraintColumnRole):
_role_name = (
"String column name or Column object for DDL foreign key constraint"
)
+
+
+class HasClauseElement(TypingOnly):
+ """indicates a class that has a __clause_element__() method"""
+
+ __slots__ = ()
+
+ if typing.TYPE_CHECKING:
+
+ def __clause_element__(self) -> "ClauseElement":
+ ...
+
+
+class HasFromClauseElement(HasClauseElement, TypingOnly):
+ """indicates a class that has a __clause_element__() method"""
+
+ __slots__ = ()
+
+ if typing.TYPE_CHECKING:
+
+ def __clause_element__(self) -> "FromClause":
+ ...