diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-07-17 15:10:54 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-07-17 15:10:54 +0000 |
commit | 8804e1963f7f391bfc29feca7155e3a5f9bb097d (patch) | |
tree | 4eb6943473836cf97884e0d3a0cd962ec363b7d2 /test/sql/test_generative.py | |
parent | f843442d97b801e1f57dc21aa0e25a30f4986018 (diff) | |
download | sqlalchemy-8804e1963f7f391bfc29feca7155e3a5f9bb097d.tar.gz |
- Fixed a bug in extract() introduced in 0.5.4 whereby
the string "field" argument was getting treated as a
ClauseElement, causing various errors within more
complex SQL transformations.
Diffstat (limited to 'test/sql/test_generative.py')
-rw-r--r-- | test/sql/test_generative.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/sql/test_generative.py b/test/sql/test_generative.py index ca427ca5f..7c094c26b 100644 --- a/test/sql/test_generative.py +++ b/test/sql/test_generative.py @@ -310,7 +310,17 @@ class ClauseTest(TestBase, AssertsCompiledSQL): "table1.col3 AS col3 FROM table1 WHERE table1.col1 = :col1_1) AS anon_1, "\ "(SELECT table1.col1 AS col1, table1.col2 AS col2, table1.col3 AS col3 FROM table1 WHERE table1.col1 = :col1_2) AS anon_2 "\ "WHERE anon_1.col2 = anon_2.col2") - + + def test_extract(self): + s = select([extract('foo', t1.c.col1).label('col1')]) + self.assert_compile(s, "SELECT EXTRACT(foo FROM table1.col1) AS col1 FROM table1") + + s2 = CloningVisitor().traverse(s).alias() + s3 = select([s2.c.col1]) + self.assert_compile(s, "SELECT EXTRACT(foo FROM table1.col1) AS col1 FROM table1") + self.assert_compile(s3, "SELECT anon_1.col1 FROM (SELECT EXTRACT(foo FROM table1.col1) AS col1 FROM table1) AS anon_1") + + @testing.emits_warning('.*replaced by another column with the same key') def test_alias(self): subq = t2.select().alias('subq') |