summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-03-21 20:43:34 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-03-21 20:43:34 +0000
commitcef652a2d612ecbf078d57fbf81abef21a18b631 (patch)
treef0729e311fc78f7d5b1817ad5ba254ffde5bc8f6 /test
parent5b2cc84aa8d43c503b24bf5342c0babeed5d6d83 (diff)
downloadsqlalchemy-cef652a2d612ecbf078d57fbf81abef21a18b631.tar.gz
- slightly better support for bind params as column clauses, either
via bindparam() or via literal(), i.e. select([literal('foo')]) - removed "table" argument from column(). this does not add the column to the table anyway so was misleading. - Select _exportable_columns() only exports Selectable instances - Select uses _exportable_columns() when searching for engines instead of _raw_columns for similar reasons (non selectables have no engine) - _BindParamClause no longer has a _make_proxy(). its not a ColumnElement. - _Label detects underlying column element and will generate its own column()._make_proxy() if the element is not a ColumnElement. this allows a Label to be declared for nearly anything and it can export itself as a column on a containing Selectable.
Diffstat (limited to 'test')
-rw-r--r--test/sql/select.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/sql/select.py b/test/sql/select.py
index b6f769959..1ca8224a8 100644
--- a/test/sql/select.py
+++ b/test/sql/select.py
@@ -678,6 +678,13 @@ myothertable.othername != :myothertable_othername AND EXISTS (select yay from fo
c = s.compile(parameters = {'test' : 7})
self.assert_(c.get_params() == {'test' : 7})
+ def testbindascol(self):
+ t = table('foo', column('id'))
+
+ s = select([t, literal('lala').label('hoho')])
+ self.runtest(s, "SELECT foo.id, :literal AS hoho FROM foo")
+ assert [str(c) for c in s.c] == ["id", "hoho"]
+
def testin(self):
self.runtest(select([table1], table1.c.myid.in_(1, 2, 3)),
"SELECT mytable.myid, mytable.name, mytable.description FROM mytable WHERE mytable.myid IN (:mytable_myid, :mytable_my_1, :mytable_my_2)")