summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-09-03 10:28:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-09-03 10:28:26 -0400
commit82e874b64b7a56311c10bffa4ffa151d539efe99 (patch)
tree927abf93d61b02794db2333c09dd9f25f96cffab /lib/sqlalchemy/sql/compiler.py
parent48f5c2e4f7b01e075c587d3ae650eba29a1fe36e (diff)
downloadsqlalchemy-82e874b64b7a56311c10bffa4ffa151d539efe99.tar.gz
- type expressions invoke in SQL, but are only for the benefit of columns
delivered to a result set. therefore these expressions should only be rendered for those columns that are being delivered to the result, thereby preventing the expression from stacking onto itself within nesting scenarios.
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 2fc14c84c..3778c7683 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -986,15 +986,13 @@ class SQLCompiler(engine.Compiled):
within_columns_clause=True):
"""produce labeled columns present in a select()."""
- if column.type._has_column_expression:
+ if column.type._has_column_expression and \
+ populate_result_map:
col_expr = column.type.column_expression(column)
- if populate_result_map:
- add_to_result_map = lambda keyname, name, objects, type_: \
- self._add_to_result_map(
- keyname, name,
- objects + (column,), type_)
- else:
- add_to_result_map = None
+ add_to_result_map = lambda keyname, name, objects, type_: \
+ self._add_to_result_map(
+ keyname, name,
+ objects + (column,), type_)
else:
col_expr = column
if populate_result_map: