diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-07 12:53:04 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-07 12:53:04 -0400 |
commit | d47a376863bd7c804e4396808841d06b78c0e13a (patch) | |
tree | ccbbd445176c6553396e988966dce14050d4da80 /lib/sqlalchemy/orm/loading.py | |
parent | 9b2d90aa5f28503dce35d53f9c76d49eec5244b4 (diff) | |
download | sqlalchemy-d47a376863bd7c804e4396808841d06b78c0e13a.tar.gz |
- add an option to Bundle single_entity=True to allow for single
entity returns without otherwise changing much [ticket:2824]
Diffstat (limited to 'lib/sqlalchemy/orm/loading.py')
-rw-r--r-- | lib/sqlalchemy/orm/loading.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/loading.py b/lib/sqlalchemy/orm/loading.py index 512a07d66..93c94c9f4 100644 --- a/lib/sqlalchemy/orm/loading.py +++ b/lib/sqlalchemy/orm/loading.py @@ -33,7 +33,8 @@ def instances(query, cursor, context): for ent in query._entities] filtered = id in filter_fns - single_entity = filtered and len(query._entities) == 1 + single_entity = len(query._entities) == 1 and \ + query._entities[0].supports_single_entity if filtered: if single_entity: @@ -43,7 +44,7 @@ def instances(query, cursor, context): return tuple(fn(x) for x, fn in zip(row, filter_fns)) custom_rows = single_entity and \ - query._entities[0].mapper.dispatch.append_result + query._entities[0].custom_rows (process, labels) = \ list(zip(*[ |