diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-02-01 01:16:18 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-02-01 01:16:18 +0000 |
commit | a0ffeb546468e14fa9d99b30571f7b8f9b32f421 (patch) | |
tree | 607a0ba4ae7ca8ff38eed0b57cd2e2a3e21c18fe /test/dialect/mssql.py | |
parent | 7bf0fca85856a3662f713e3cc9e451b3c0ac344b (diff) | |
download | sqlalchemy-a0ffeb546468e14fa9d99b30571f7b8f9b32f421.tar.gz |
- some consolidation of tests in select.py, moved
other tests to more specific modules
- added "now()" as a generic function; on SQLite and
Oracle compiles as "CURRENT_TIMESTAMP"; "now()"
on all others [ticket:943]
Diffstat (limited to 'test/dialect/mssql.py')
-rwxr-xr-x | test/dialect/mssql.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py index 0b7a8444b..4fb918c7f 100755 --- a/test/dialect/mssql.py +++ b/test/dialect/mssql.py @@ -21,6 +21,39 @@ class CompileTest(SQLCompileTest): t = table('sometable', column('somecolumn')) self.assert_compile(t.count(), "SELECT count(sometable.somecolumn) AS tbl_row_count FROM sometable") + def test_noorderby_insubquery(self): + """test that the ms-sql dialect removes ORDER BY clauses from subqueries""" + + table1 = table('mytable', + column('myid', Integer), + column('name', String), + column('description', String), + ) + + q = select([table1.c.myid], order_by=[table1.c.myid]).alias('foo') + crit = q.c.myid == table1.c.myid + self.assert_compile(select(['*'], crit), """SELECT * FROM (SELECT mytable.myid AS myid FROM mytable) AS foo, mytable WHERE foo.myid = mytable.myid""") + + def test_aliases_schemas(self): + metadata = MetaData() + table1 = table('mytable', + column('myid', Integer), + column('name', String), + column('description', String), + ) + + table4 = Table( + 'remotetable', metadata, + Column('rem_id', Integer, primary_key=True), + Column('datatype_id', Integer), + Column('value', String(20)), + schema = 'remote_owner' + ) + + self.assert_compile(table4.select(), "SELECT remotetable_1.rem_id, remotetable_1.datatype_id, remotetable_1.value FROM remote_owner.remotetable AS remotetable_1") + + self.assert_compile(table1.join(table4, table1.c.myid==table4.c.rem_id).select(), "SELECT mytable.myid, mytable.name, mytable.description, remotetable_1.rem_id, remotetable_1.datatype_id, remotetable_1.value FROM mytable JOIN remote_owner.remotetable AS remotetable_1 ON remotetable_1.rem_id = mytable.myid") + def test_union(self): t1 = table('t1', column('col1'), |