summaryrefslogtreecommitdiff
path: root/test/dialect/mssql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-12-01 14:28:57 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-12-01 14:28:57 -0500
commit87cdda008673e01e2c32049f103e9cdebd2a5d77 (patch)
tree8044a91347caf5ff76bb4ff48f7654fcbc8e51a6 /test/dialect/mssql/test_compiler.py
parentc8dea359db9bea58dc64880d306dbee2a26df247 (diff)
downloadsqlalchemy-87cdda008673e01e2c32049f103e9cdebd2a5d77.tar.gz
Move CRUDTest, InlineDefaultTest from test_compiler
test_compiler is mostly related to SELECT statements as well as smaller SQL elements. While it still has some DDL related tests, move out all the remaining insert/update tests into the already present test_insert.py, test_update.py Fixes: #2630 Change-Id: I4167618543fd1235d12d1717c8c629d2374b325a
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r--test/dialect/mssql/test_compiler.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py
index 0a79b3e59..70b9a6c90 100644
--- a/test/dialect/mssql/test_compiler.py
+++ b/test/dialect/mssql/test_compiler.py
@@ -170,6 +170,35 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
)
self.assert_compile(sql.delete(a1), "DELETE FROM t1 AS a1")
+ def test_update_from(self):
+ metadata = MetaData()
+ table1 = Table(
+ 'mytable', metadata,
+ Column('myid', Integer),
+ Column('name', String(30)),
+ Column('description', String(50)))
+ table2 = Table(
+ 'myothertable', metadata,
+ Column('otherid', Integer),
+ Column('othername', String(30)))
+
+ mt = table1.alias()
+
+ u = table1.update().values(name='foo')\
+ .where(table2.c.otherid == table1.c.myid)
+
+ # testing mssql.base.MSSQLCompiler.update_from_clause
+ self.assert_compile(u,
+ "UPDATE mytable SET name=:name "
+ "FROM mytable, myothertable WHERE "
+ "myothertable.otherid = mytable.myid")
+
+ self.assert_compile(u.where(table2.c.othername == mt.c.name),
+ "UPDATE mytable SET name=:name "
+ "FROM mytable, myothertable, mytable AS mytable_1 "
+ "WHERE myothertable.otherid = mytable.myid "
+ "AND myothertable.othername = mytable_1.name")
+
def test_update_from_hint(self):
t = table('sometable', column('somecolumn'))
t2 = table('othertable', column('somecolumn'))