summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-07-15 04:50:11 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-07-15 04:50:11 +0000
commit3a9af19d145703254c0e738af31cd4d20047c449 (patch)
tree1d7887bc33727196be5d2c7aff2521221d2666e5 /lib/sqlalchemy/sql.py
parente40a6183a0ee301a3c79d4833816894b3349ee0e (diff)
downloadsqlalchemy-3a9af19d145703254c0e738af31cd4d20047c449.tar.gz
- 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
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py7
1 files changed, 7 insertions, 0 deletions
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):