diff options
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index d7c7cebaa..583a02763 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1481,13 +1481,12 @@ class ResultProxy(object): rec = props[key] except KeyError: # fallback for targeting a ColumnElement to a textual expression - # it would be nice to get rid of this but we make use of it in the case where - # you say something like query.options(contains_alias('fooalias')) - the matching - # is done on strings + # this is a rare use case which only occurs when matching text() + # constructs to ColumnElements if isinstance(key, expression.ColumnElement): if key._label and key._label.lower() in props: return props[key._label.lower()] - elif key.name.lower() in props: + elif hasattr(key, 'name') and key.name.lower() in props: return props[key.name.lower()] raise exceptions.NoSuchColumnError("Could not locate column in row for column '%s'" % (str(key))) |
