From f7fe966a4c40fbe98e6321d275ffee8f898a211b Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 25 Nov 2019 15:09:47 -0500 Subject: Remove ORM elements from annotations at the schema level. Fixed issue where when constructing constraints from ORM-bound columns, primarily :class:`.ForeignKey` objects but also :class:`.UniqueConstraint`, :class:`.CheckConstraint` and others, the ORM-level :class:`.InstrumentedAttribute` is discarded entirely, and all ORM-level annotations from the columns are removed; this is so that the constraints are still fully pickleable without the ORM-level entities being pulled in. These annotations are not necessary to be present at the schema/metadata level. Fully implemented coercions for constraint columns within schema.py, including for FK referenced columns. Fixes: #5001 Change-Id: I895400dd979310be034085d207f096707c635909 --- lib/sqlalchemy/sql/roles.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql/roles.py') diff --git a/lib/sqlalchemy/sql/roles.py b/lib/sqlalchemy/sql/roles.py index 55c52d401..caa68d0ab 100644 --- a/lib/sqlalchemy/sql/roles.py +++ b/lib/sqlalchemy/sql/roles.py @@ -186,4 +186,10 @@ class DDLExpressionRole(StructuralRole): class DDLConstraintColumnRole(SQLRole): - _role_name = "String column name or column object for DDL constraint" + _role_name = "String column name or column expression for DDL constraint" + + +class DDLReferredColumnRole(DDLConstraintColumnRole): + _role_name = ( + "String column name or Column object for DDL foreign key constraint" + ) -- cgit v1.2.1