summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-12-18 16:50:49 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-12-18 16:50:49 +0000
commitb3337893365a720646e073806b9a379ad839a970 (patch)
tree18bfb4913a0ac9ab535211e0719df69864905e03 /test/sql
parent793339505569fe5e69ad4c9a70071406aa11a09e (diff)
downloadsqlalchemy-b3337893365a720646e073806b9a379ad839a970.tar.gz
- Query() can be passed a "composite" attribute
as a column expression and it will be expanded. Somewhat related to [ticket:1253]. - Query() is a little more robust when passed various column expressions such as strings, clauselists, text() constructs (which may mean it just raises an error more nicely). - select() can accept a ClauseList as a column in the same way as a Table or other selectable and the interior expressions will be used as column elements. [ticket:1253] - removed erroneous FooTest from test/orm/query -This line, and those below, will be ignored-- M test/orm/query.py M test/orm/mapper.py M test/sql/select.py M lib/sqlalchemy/orm/query.py M lib/sqlalchemy/sql/expression.py M CHANGES
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/select.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index 352eed42c..12c8524cf 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -3,6 +3,7 @@ import datetime, re, operator
from sqlalchemy import *
from sqlalchemy import exc, sql, util
from sqlalchemy.sql import table, column, label, compiler
+from sqlalchemy.sql.expression import ClauseList
from sqlalchemy.engine import default
from sqlalchemy.databases import sqlite, postgres, mysql, oracle, firebird, mssql
from testlib import *
@@ -125,6 +126,11 @@ sq2.sq_myothertable_otherid, sq2.sq_myothertable_othername FROM \
sq.mytable_description AS sq_mytable_description, sq.myothertable_otherid AS sq_myothertable_otherid, \
sq.myothertable_othername AS sq_myothertable_othername FROM (" + sqstring + ") AS sq) AS sq2")
+ def test_select_from_clauselist(self):
+ self.assert_compile(
+ select([ClauseList(column('a'), column('b'))]).select_from('sometable'),
+ 'SELECT a, b FROM sometable'
+ )
def test_nested_uselabels(self):
"""test nested anonymous label generation. this
essentially tests the ANONYMOUS_LABEL regex.