]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Remove ORM elements from annotations at the schema level.
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 25 Nov 2019 20:09:47 +0000 (15:09 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 26 Nov 2019 15:42:17 +0000 (10:42 -0500)
commitf7fe966a4c40fbe98e6321d275ffee8f898a211b
tree294b98de75acc45554ab078f38279742b68ea049
parentc2432d9d190bdc67f274b8da9296ff9ed044bef1
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
doc/build/changelog/unreleased_14/5001.rst [new file with mode: 0644]
lib/sqlalchemy/sql/coercions.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/roles.py
lib/sqlalchemy/sql/schema.py
test/sql/test_metadata.py