]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fixed bug where "from" clause gathering from an
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Apr 2011 03:44:03 +0000 (23:44 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 15 Apr 2011 03:44:03 +0000 (23:44 -0400)
    over() clause would be an itertools.chain() and
    not a list, causing "can only concatenate list"
    TypeError when combined with other clauses.

CHANGES
lib/sqlalchemy/sql/expression.py
test/sql/test_compiler.py

diff --git a/CHANGES b/CHANGES
index 5d4d7cd8715d73b0468e94f151b4250ea8ab1bd1..16fe6200d5780716aec66796b3b67073e7421728 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -91,6 +91,11 @@ CHANGES
     will be coerced to integer.  [ticket:2116]
     (also in 0.6.7)
 
+  - fixed bug where "from" clause gathering from an
+    over() clause would be an itertools.chain() and
+    not a list, causing "can only concatenate list"
+    TypeError when combined with other clauses.
+
 - engine
   - The C extension is now enabled by default on CPython
     2.x with a fallback to pure python if it fails to
index f5ec41a60d40e3730d1cc289881cf5e177767cb7..c9647e1bd9a8406b33689254f3dcb2fc850b1493 100644 (file)
@@ -3704,11 +3704,11 @@ class _Over(ColumnElement):
 
     @property
     def _from_objects(self):
-        return itertools.chain(
+        return list(itertools.chain(
             *[c._from_objects for c in 
                 (self.func, self.partition_by, self.order_by) 
             if c is not None]
-        )
+        ))
 
 class _Label(ColumnElement):
     """Represents a column label (AS).
index ce3e9003bca7048d3a1d6aaef4b527d3e44e99a1..abebb7b3ba803f5641a99a618ea7c272aaae458f 100644 (file)
@@ -2146,6 +2146,12 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
             "AS anon_1 FROM mytable"
         )
 
+        # this tests that _from_objects 
+        # concantenates OK
+        self.assert_compile(
+            select([column("x") + over(func.foo())]),
+            "SELECT x + foo() OVER () AS anon_1"
+        )
 
 
     def test_date_between(self):