summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-08-04 15:21:29 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-08-04 15:21:29 +0000
commitd371637af055805f347ad177f5b457bccbbc3150 (patch)
tree890539bd5cecfe9b42aeb57546edf39a658cf599 /lib/sqlalchemy/ext
parent28ff190475b1717a7cb8616a7ad8590c00a9a6c8 (diff)
downloadsqlalchemy-d371637af055805f347ad177f5b457bccbbc3150.tar.gz
- fixed endless loop bug which could occur
within a mapper's deferred load of inherited attributes. - declarative initialization of Columns adjusted so that non-renamed columns initialize in the same way as a non declarative mapper. This allows an inheriting mapper to set up its same-named "id" columns in particular such that the parent "id" column is favored over the child column, reducing database round trips when this value is requested.
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r--lib/sqlalchemy/ext/declarative.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py
index 47ee427dd..65af2da7a 100644
--- a/lib/sqlalchemy/ext/declarative.py
+++ b/lib/sqlalchemy/ext/declarative.py
@@ -270,6 +270,13 @@ def _as_declarative(cls, classname, dict_):
elif isinstance(c, Column):
_undefer_column_name(key, c)
cols.append(c)
+ # if the column is the same name as the key,
+ # remove it from the explicit properties dict.
+ # the normal rules for assigning column-based properties
+ # will take over, including precedence of columns
+ # in multi-column ColumnProperties.
+ if key == c.key:
+ del our_stuff[key]
cls.__table__ = table = Table(tablename, cls.metadata,
*(tuple(cols) + tuple(args)), **table_kw)
else: