From: Mike Bayer Date: Tue, 19 Feb 2008 23:46:14 +0000 (+0000) Subject: - can again create aliases of selects against textual X-Git-Tag: rel_0_4_4~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f43bc55e027b6419ac5a9893515ad9581c98538;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - can again create aliases of selects against textual FROM clauses, [ticket:975] --- diff --git a/CHANGES b/CHANGES index cd8c1de4a7..53f4258e6b 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,10 @@ CHANGES ======= 0.4.4 ------ +- sql + - can again create aliases of selects against textual + FROM clauses, [ticket:975] + - orm - any(), has(), contains(), attribute level == and != now work properly with self-referential relations - the clause diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index b39e406da1..e39487c548 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1718,6 +1718,7 @@ class _TextFromClause(FromClause): def __init__(self, text): self.name = text + self.oid_column = None class _BindParamClause(ClauseElement, _CompareMixin): """Represent a bind parameter. diff --git a/test/sql/select.py b/test/sql/select.py index 39906dcdb9..f64373d3ab 100644 --- a/test/sql/select.py +++ b/test/sql/select.py @@ -625,6 +625,11 @@ WHERE mytable.myid = myothertable.otherid) AS t2view WHERE t2view.mytable_myid = select(["column1 AS foobar", "column2 AS hoho", table1.c.myid], from_obj=[table1]).select(), "SELECT column1 AS foobar, column2 AS hoho, myid FROM (SELECT column1 AS foobar, column2 AS hoho, mytable.myid AS myid FROM mytable)" ) + + self.assert_compile( + select(['col1','col2'], from_obj='tablename').alias('myalias'), + "SELECT col1, col2 FROM tablename" + ) def test_binds_in_text(self): self.assert_compile(