summaryrefslogtreecommitdiff
path: root/test/sql/test_text.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-09-06 17:56:53 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-09-06 17:56:53 -0400
commite80c7cc5c103788a4c7e1c479af2c37cd9c958b3 (patch)
tree87df4dd4fe620b16df15d3ff5f6b7c04ba913a74 /test/sql/test_text.py
parent4e285fd6ba2cbaf4b43e943a0e6bb45cc104cf08 (diff)
downloadsqlalchemy-e80c7cc5c103788a4c7e1c479af2c37cd9c958b3.tar.gz
wip for #3148
Diffstat (limited to 'test/sql/test_text.py')
-rw-r--r--test/sql/test_text.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/sql/test_text.py b/test/sql/test_text.py
index e84a2907c..94627ae07 100644
--- a/test/sql/test_text.py
+++ b/test/sql/test_text.py
@@ -6,7 +6,7 @@ from sqlalchemy import text, select, Integer, String, Float, \
bindparam, and_, func, literal_column, exc, MetaData, Table, Column,\
asc, func, desc, union
from sqlalchemy.types import NullType
-from sqlalchemy.sql import table, column
+from sqlalchemy.sql import table, column, util as sql_util
from sqlalchemy import util
table1 = table('mytable',
@@ -679,3 +679,29 @@ class OrderByLabelResolutionTest(fixtures.TestBase, AssertsCompiledSQL):
desc("somelabel"),
"somelabel DESC"
)
+
+ def test_anonymized_via_columnadapter(self):
+ """test issue #3148
+
+ Testing the anonymization applied from the ColumnAdapter.columns
+ collection, typically as used in eager loading.
+
+ """
+ exprs = [
+ table1.c.myid,
+ table1.c.name.label('t1name'),
+ func.foo("hoho").label('x')]
+
+ ta = table1.alias()
+ adapter = sql_util.ColumnAdapter(ta)
+
+ s1 = select([adapter.columns[expr] for expr in exprs]).\
+ apply_labels().order_by("myid", "t1name", "x")
+
+ # our "t1name" and "x" labels get modified
+ self.assert_compile(
+ s1,
+ "SELECT mytable_1.myid AS mytable_1_myid, "
+ "mytable_1.name AS name_1, foo(:foo_2) AS foo_1 "
+ "FROM mytable AS mytable_1 ORDER BY mytable_1.myid, name_1, foo_1"
+ )