diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-08 19:47:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-08 19:47:13 -0400 |
| commit | 9df4651fba6d1cd3d2b490f58263cc45a81788f4 (patch) | |
| tree | 03289aaa180ca7a5452740a73c2f0e6c9b1979fd /lib/sqlalchemy/sql/elements.py | |
| parent | 5f07d4b7acc7fee3eb9d9621e0aece96718b902f (diff) | |
| download | sqlalchemy-9df4651fba6d1cd3d2b490f58263cc45a81788f4.tar.gz | |
Fixed bug where using an annotation such as :func:`.remote` or
:func:`.foreign` on a :class:`.Column` before association with a parent
:class:`.Table` could produce issues related to the parent table not
rendering within joins, due to the inherent copy operation performed
by an annotation. [ticket:2813]
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
| -rw-r--r-- | lib/sqlalchemy/sql/elements.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 73a8a0b82..2688ef103 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2466,7 +2466,7 @@ class AnnotatedColumnElement(Annotated): def __init__(self, element, values): Annotated.__init__(self, element, values) ColumnElement.comparator._reset(self) - for attr in ('name', 'key'): + for attr in ('name', 'key', 'table'): if self.__dict__.get(attr, False) is None: self.__dict__.pop(attr) @@ -2481,6 +2481,11 @@ class AnnotatedColumnElement(Annotated): return self._Annotated__element.name @util.memoized_property + def table(self): + """pull 'table' from parent, if not present""" + return self._Annotated__element.table + + @util.memoized_property def key(self): """pull 'key' from parent, if not present""" return self._Annotated__element.key |
