diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-07-02 11:49:56 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-07-02 13:26:36 -0400 |
commit | f8d15739d36da138d34fb3fecac1fa043e65e48d (patch) | |
tree | 5e5a3a545d95456470da79f468b8a2e4d24c0dcf /lib/sqlalchemy/sql | |
parent | 4b5ed6ad27b3b63ecf1b082653e2e3ee0abb887f (diff) | |
download | sqlalchemy-f8d15739d36da138d34fb3fecac1fa043e65e48d.tar.gz |
call toinstance() on type arguments passed to mapped_column()
Change-Id: I875cfbd925cb08e0a5235f87d13341d319c955bc
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/type_api.py | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index c67614070..de833cd89 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -46,7 +46,7 @@ from .elements import Slice from .elements import TypeCoerce as type_coerce # noqa from .type_api import Emulated from .type_api import NativeForEmulated # noqa -from .type_api import to_instance +from .type_api import to_instance as to_instance from .type_api import TypeDecorator as TypeDecorator from .type_api import TypeEngine as TypeEngine from .type_api import TypeEngineMixin diff --git a/lib/sqlalchemy/sql/type_api.py b/lib/sqlalchemy/sql/type_api.py index 46bf151ea..efaf5d2a7 100644 --- a/lib/sqlalchemy/sql/type_api.py +++ b/lib/sqlalchemy/sql/type_api.py @@ -41,6 +41,7 @@ from ..util.typing import TypeGuard # these are back-assigned by sqltypes. if typing.TYPE_CHECKING: + from ._typing import _TypeEngineArgument from .elements import BindParameter from .elements import ColumnElement from .operators import OperatorType @@ -55,7 +56,6 @@ if typing.TYPE_CHECKING: from .sqltypes import TABLEVALUE as TABLEVALUE # noqa: F401 from ..engine.interfaces import Dialect - _T = TypeVar("_T", bound=Any) _T_co = TypeVar("_T_co", bound=Any, covariant=True) _T_con = TypeVar("_T_con", bound=Any, contravariant=True) @@ -642,7 +642,9 @@ class TypeEngine(Visitable, Generic[_T]): raise NotImplementedError() def with_variant( - self: SelfTypeEngine, type_: TypeEngine[Any], *dialect_names: str + self: SelfTypeEngine, + type_: _TypeEngineArgument[Any], + *dialect_names: str, ) -> SelfTypeEngine: r"""Produce a copy of this type object that will utilize the given type when applied to the dialect of the given name. |