]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add public alias of type _ColumnExpressionArgument
authorFederico Caselli <cfederico87@gmail.com>
Mon, 24 Apr 2023 09:24:32 +0000 (11:24 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 27 Apr 2023 21:32:25 +0000 (23:32 +0200)
Added type ``ColumnExpressionArgument`` as a public alias of an internal
type. This type is useful since it's what' accepted by the sqlalchemy in
many api calls, such as :meth:`_sql.Select.where`, :meth:`_sql.and` and
many other.

Fixes: #9656
Change-Id: I79a38a0c1417d0ed1b6efff00497dba5e2be4f79

doc/build/changelog/unreleased_20/9656.rst [new file with mode: 0644]
doc/build/core/internals.rst
lib/sqlalchemy/__init__.py
lib/sqlalchemy/sql/__init__.py
lib/sqlalchemy/sql/_typing.py

diff --git a/doc/build/changelog/unreleased_20/9656.rst b/doc/build/changelog/unreleased_20/9656.rst
new file mode 100644 (file)
index 0000000..16c170a
--- /dev/null
@@ -0,0 +1,8 @@
+.. change::
+    :tags: typing, sql
+    :tickets: 9656
+
+    Added type ``ColumnExpressionArgument`` as a public alias of an internal
+    type. This type is useful since it's what' accepted by the sqlalchemy in
+    many api calls, such as :meth:`_sql.Select.where`, :meth:`_sql.and` and
+    many other.
index e3769b3422e1cd7517d7a419837cbad1003a5e7f..26aa9831d2821d2dadac2df9eda2ca2b921cb649 100644 (file)
@@ -69,3 +69,6 @@ Some key internal constructs are listed here.
 
 .. autoclass:: sqlalchemy.engine.AdaptedConnection
     :members:
+
+.. autoattribute:: sqlalchemy.sql.ColumnExpressionArgument
+    :members:
index e9f94f1d9b01a32925a06af8e5551335d1c7efdf..ed37598edefcc254e66488a8c034779f6a097fbe 100644 (file)
@@ -79,6 +79,7 @@ from .schema import PrimaryKeyConstraint as PrimaryKeyConstraint
 from .schema import Sequence as Sequence
 from .schema import Table as Table
 from .schema import UniqueConstraint as UniqueConstraint
+from .sql import ColumnExpressionArgument as ColumnExpressionArgument
 from .sql import SelectLabelStyle as SelectLabelStyle
 from .sql.expression import Alias as Alias
 from .sql.expression import alias as alias
index e5bbe65daca5b04c9481ba025006821e8e51aa36..96cffed7d0e1376bc5ea95625b778f49d930748f 100644 (file)
@@ -7,6 +7,7 @@
 from typing import Any
 from typing import TYPE_CHECKING
 
+from ._typing import ColumnExpressionArgument as ColumnExpressionArgument
 from .base import Executable as Executable
 from .compiler import COLLECT_CARTESIAN_PRODUCTS as COLLECT_CARTESIAN_PRODUCTS
 from .compiler import FROM_LINTING as FROM_LINTING
index 596493b7cd86a0c9d69059b553cf3953f3ec3992..9e83c3f429cbec9b7029388da5bd1aff786e0059 100644 (file)
@@ -26,6 +26,7 @@ from .. import util
 from ..inspection import Inspectable
 from ..util.typing import Literal
 from ..util.typing import Protocol
+from ..util.typing import TypeAlias
 
 if TYPE_CHECKING:
     from datetime import date
@@ -175,7 +176,10 @@ _ColumnExpressionArgument = Union[
     Callable[[], "ColumnElement[_T]"],
     "LambdaElement",
 ]
-"""narrower "column expression" argument.
+"See docs in public alias ColumnExpressionArgument."
+
+ColumnExpressionArgument: TypeAlias = _ColumnExpressionArgument[_T]
+"""Narrower "column expression" argument.
 
 This type is used for all the other "column" kinds of expressions that
 typically represent a single SQL column expression, not a set of columns the
@@ -184,10 +188,8 @@ way a table or ORM entity does.
 This includes ColumnElement, or ORM-mapped attributes that will have a
 `__clause_element__()` method, it also has the ExpressionElementRole
 overall which brings in the TextClause object also.
-
 """
 
-
 _ColumnExpressionOrLiteralArgument = Union[Any, _ColumnExpressionArgument[_T]]
 
 _ColumnExpressionOrStrLabelArgument = Union[str, _ColumnExpressionArgument[_T]]