[Sqlalchemy-commits] sqlalchemy: - fixed bug where "from" clause gathering from an
Brought to you by:
zzzeek
From: <co...@sq...> - 2011-04-15 03:44:16
|
details: http://hg.sqlalchemy.org/sqlalchemy/sqlalchemy/rev/79797e7d2ec9 changeset: 7534:79797e7d2ec9 user: zzzeek date: Thu Apr 14 23:44:03 2011 -0400 description: - 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. diffstat: CHANGES | 5 +++++ lib/sqlalchemy/sql/expression.py | 4 ++-- test/sql/test_compiler.py | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diffs (48 lines): diff -r c01c12ac4f75 -r 79797e7d2ec9 CHANGES --- a/CHANGES Thu Apr 14 21:08:54 2011 -0400 +++ b/CHANGES Thu Apr 14 23:44:03 2011 -0400 @@ -91,6 +91,11 @@ 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 diff -r c01c12ac4f75 -r 79797e7d2ec9 lib/sqlalchemy/sql/expression.py --- a/lib/sqlalchemy/sql/expression.py Thu Apr 14 21:08:54 2011 -0400 +++ b/lib/sqlalchemy/sql/expression.py Thu Apr 14 23:44:03 2011 -0400 @@ -3704,11 +3704,11 @@ @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). diff -r c01c12ac4f75 -r 79797e7d2ec9 test/sql/test_compiler.py --- a/test/sql/test_compiler.py Thu Apr 14 21:08:54 2011 -0400 +++ b/test/sql/test_compiler.py Thu Apr 14 23:44:03 2011 -0400 @@ -2146,6 +2146,12 @@ "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): |