summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/mapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/mapper.py')
-rw-r--r--lib/sqlalchemy/orm/mapper.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index 447a5fce1..4e7b4d272 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -1094,7 +1094,7 @@ class Mapper(_InspectionAttr):
# initialized; check for 'readonly'
if hasattr(self, '_readonly_props') and \
(not hasattr(col, 'table') or
- col.table not in self._cols_by_table):
+ col.table not in self._cols_by_table):
self._readonly_props.add(prop)
else:
@@ -1132,6 +1132,16 @@ class Mapper(_InspectionAttr):
"%r for column %r" % (syn, key, key, syn)
)
+ if key in self._props and \
+ not isinstance(prop, properties.ColumnProperty) and \
+ not isinstance(self._props[key], properties.ColumnProperty):
+ util.warn("Property %s on %s being replaced with new "
+ "property %s; the old property will be discarded" % (
+ self._props[key],
+ self,
+ prop,
+ ))
+
self._props[key] = prop
if not self.non_primary: