diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-28 14:56:17 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2023-01-28 16:29:05 -0500 |
commit | 4cae82d51f80c8a7e1a23b26c74b07e01059b804 (patch) | |
tree | d5c4e3b683611e9ecdda2e120aab2ea304edc67d /lib/sqlalchemy | |
parent | 586df197615d91af56aefc0d5ff94ceac13154eb (diff) | |
download | sqlalchemy-4cae82d51f80c8a7e1a23b26c74b07e01059b804.tar.gz |
Place DDLConstraintColumn Role in Mapped
Fixed typing issue where :func:`_orm.mapped_column` objects typed as
:class:`_orm.Mapped` wouldn't be accepted in schema constraints such as
:class:`_schema.ForeignKey`, :class:`_schema.UniqueConstraint` or
:class:`_schema.Index`.
Fixes: #9170
Change-Id: I41c76d224a1fa2377de151d2a713ba3f43bd245c
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 1 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/base.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/properties.py | 2 |
3 files changed, 2 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 261a633a3..cdc729f73 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -135,7 +135,6 @@ class QueryableAttribute( interfaces.PropComparator[_T], roles.JoinTargetRole, roles.OnClauseRole, - roles.DDLConstraintColumnRole, sql_base.Immutable, cache_key.SlotsMemoizedHasCacheKey, util.MemoizedSlots, diff --git a/lib/sqlalchemy/orm/base.py b/lib/sqlalchemy/orm/base.py index 331464cf8..5b6675365 100644 --- a/lib/sqlalchemy/orm/base.py +++ b/lib/sqlalchemy/orm/base.py @@ -31,6 +31,7 @@ from ._typing import insp_is_mapper from .. import exc as sa_exc from .. import inspection from .. import util +from ..sql import roles from ..sql.elements import SQLColumnExpression from ..sql.elements import SQLCoreOperations from ..util import FastIntFlag @@ -775,6 +776,7 @@ class Mapped( SQLORMExpression[_T], ORMDescriptor[_T], _MappedAnnotationBase[_T], + roles.DDLConstraintColumnRole, ): """Represent an ORM mapped attribute on a mapped class. diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index baaa0291b..9feb72e40 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -47,7 +47,6 @@ from .. import util from ..sql import coercions from ..sql import roles from ..sql.base import _NoArg -from ..sql.roles import DDLConstraintColumnRole from ..sql.schema import Column from ..sql.schema import SchemaConst from ..sql.type_api import TypeEngine @@ -504,7 +503,6 @@ class MappedSQLExpression(ColumnProperty[_T], _DeclarativeMapped[_T]): class MappedColumn( - DDLConstraintColumnRole, _IntrospectsAnnotations, _MapsColumns[_T], _DeclarativeMapped[_T], |