diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-22 17:40:50 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-22 17:40:50 -0500 |
commit | 37773f34488a5f5d65bf31d5d1b899ea56e6af8a (patch) | |
tree | 259de757db52055abc2798b14316e2c2474596af /lib/sqlalchemy/engine/base.py | |
parent | 09f3a284d82f8aa48e59fd935dc4b8b3fab43e2f (diff) | |
download | sqlalchemy-37773f34488a5f5d65bf31d5d1b899ea56e6af8a.tar.gz |
- adjust the test for [ticket:2377] to be less controversial on
problematic backends like Oracle.i
- move the check generated in r85017c4310d2 up for both label name/name
comparisions, fixes additional mismatches which can occur
Diffstat (limited to 'lib/sqlalchemy/engine/base.py')
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 36365e524..db19fe7de 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -2641,22 +2641,25 @@ class ResultMetaData(object): result = map.get(key.lower()) # fallback for targeting a ColumnElement to a textual expression # this is a rare use case which only occurs when matching text() - # constructs to ColumnElements, and after a pickle/unpickle roundtrip + # or colummn('name') constructs to ColumnElements, or after a + # pickle/unpickle roundtrip elif isinstance(key, expression.ColumnElement): if key._label and key._label.lower() in map: result = map[key._label.lower()] elif hasattr(key, 'name') and key.name.lower() in map: - # match is only on name. search - # extra hard to make sure this isn't a column/ - # label name overlap + # match is only on name. result = map[key.name.lower()] - - if result[1] is not None: - for obj in result[1]: - if key._compare_name_for_result(obj): - break - else: - result = None + # search extra hard to make sure this + # isn't a column/label name overlap. + # this check isn't currently available if the row + # was unpickled. + if result is not None and \ + result[1] is not None: + for obj in result[1]: + if key._compare_name_for_result(obj): + break + else: + result = None if result is None: if raiseerr: raise exc.NoSuchColumnError( |