summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/functions.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-09 11:49:02 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-14 16:30:41 -0500
commit4999784664b9e73204474dd3dd91ee60fd174e3e (patch)
tree18f612f9960d5abee702b1bc1e0769ca26728793 /lib/sqlalchemy/sql/functions.py
parent43f6ae639ca0186f4802255861acdc20f19e702f (diff)
downloadsqlalchemy-4999784664b9e73204474dd3dd91ee60fd174e3e.tar.gz
Initial ORM typing layout
introduces: 1. new mapped_column() helper 2. DeclarativeBase helper 3. declared_attr has been re-typed 4. rework of Mapped[] to return InstrumentedAtribute for class get, so works without Mapped itself having expression methods 5. ORM constructs now generic on [_T] also includes some early typing work, most of which will be in later commits: 1. URL and History become typing.NamedTuple 2. come up with type-checking friendly way of type checking cy extensions, where type checking will be applied to the py versions, just needed to come up with a succinct conditional pattern for the imports References: #6810 References: #7535 References: #7562 Change-Id: Ie5d9a44631626c021d130ca4ce395aba623c71fb
Diffstat (limited to 'lib/sqlalchemy/sql/functions.py')
-rw-r--r--lib/sqlalchemy/sql/functions.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py
index 7a1e80889..2e6d64c55 100644
--- a/lib/sqlalchemy/sql/functions.py
+++ b/lib/sqlalchemy/sql/functions.py
@@ -9,6 +9,9 @@
"""
+from typing import Any
+from typing import TypeVar
+
from . import annotation
from . import coercions
from . import operators
@@ -42,6 +45,8 @@ from .visitors import InternalTraversal
from .. import util
+_T = TypeVar("_T", bound=Any)
+
_registry = util.defaultdict(dict)
@@ -67,7 +72,7 @@ def register_function(identifier, fn, package="_default"):
reg[identifier] = fn
-class FunctionElement(Executable, ColumnElement, FromClause, Generative):
+class FunctionElement(Executable, ColumnElement[_T], FromClause, Generative):
"""Base for SQL function-oriented constructs.
.. seealso::