summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-08-01 11:45:34 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-08-01 11:51:07 -0400
commit896d47f318c5c27620fd6da805f98811941b88c5 (patch)
treefb13c9fbd53f38c783249c7e99674e148026e08a /lib/sqlalchemy/sql/schema.py
parent71ca345a12f554be70d8d990a66f6a4165477dcb (diff)
downloadsqlalchemy-896d47f318c5c27620fd6da805f98811941b88c5.tar.gz
Don't assume key when matching cloned columns in _make_proxy
Fixed issue where internal cloning of SELECT constructs could lead to a key error if the copy of the SELECT changed its state such that its list of columns changed. This was observed to be occurring in some ORM scenarios which may be unique to 1.3 and above, so is partially a regression fix. For 1.4, the _is_clone_of key will be removed entirely as it seems to have no purpose. This commit is the initial backport to 1.3 which includes tests. Fixes: #4780 Change-Id: I0c64962a2eba3763bea3107fc7c7d7aed8244430
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r--lib/sqlalchemy/sql/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index c63a3160f..beebc5b1f 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -1608,7 +1608,7 @@ class Column(DialectKWArgs, SchemaItem, ColumnClause):
c.table = selectable
if selectable._is_clone_of is not None:
- c._is_clone_of = selectable._is_clone_of.columns[c.key]
+ c._is_clone_of = selectable._is_clone_of.columns.get(c.key)
if self.primary_key:
selectable.primary_key.add(c)
if fk: