From 3a9af19d145703254c0e738af31cd4d20047c449 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 15 Jul 2007 04:50:11 +0000 Subject: - columns can be overridden in a reflected table with a "key" attribute different than the column's name, including for primary key columns [ticket:650] - more docs --- lib/sqlalchemy/sql.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/sqlalchemy/sql.py') diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 0961cd4ee..4c720dfa2 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -1592,6 +1592,13 @@ class ColumnCollection(util.OrderedProperties): The key attribute of the column will be used as the hash key for this dictionary. """ + + # Allow an aliased column to replace an unaliased column of the + # same name. + if self.has_key(column.name): + other = self[column.name] + if other.name == other.key: + del self[other.name] self[column.key] = column def remove(self, column): -- cgit v1.2.1