summaryrefslogtreecommitdiff
path: root/test/dialect/mssql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-08-03 14:08:32 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-08-03 20:47:27 -0400
commitf684bb7659ff195d4c55414162c1de4fbfdafc2f (patch)
treef5bb7d7a4d2e03af9470ed2c539acd33ae6462d9 /test/dialect/mssql/test_compiler.py
parentea6fb4ff5bcffcf71cdbc587504f10f03fe921ca (diff)
downloadsqlalchemy-f684bb7659ff195d4c55414162c1de4fbfdafc2f.tar.gz
ensure RETURNING renders in stringify w/ no server version
just in my own testing, if I say insert().return_defaults() and stringify, I should see it, so make sure all the dialects default to "insert_returning" etc. , with downgrade on server version check. Change-Id: Id64e78fcb03c48b5dcb0feb21cb9cc495edd15e9
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r--test/dialect/mssql/test_compiler.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py
index 74722e949..8605ea9c0 100644
--- a/test/dialect/mssql/test_compiler.py
+++ b/test/dialect/mssql/test_compiler.py
@@ -53,6 +53,22 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
self.assert_compile(sql.false(), "0")
self.assert_compile(sql.true(), "1")
+ def test_plain_stringify_returning(self):
+ t = Table(
+ "t",
+ MetaData(),
+ Column("myid", Integer, primary_key=True),
+ Column("name", String, server_default="some str"),
+ Column("description", String, default=func.lower("hi")),
+ )
+ stmt = t.insert().values().return_defaults()
+ eq_ignore_whitespace(
+ str(stmt.compile(dialect=mssql.dialect())),
+ "INSERT INTO t (description) "
+ "OUTPUT inserted.myid, inserted.name, inserted.description "
+ "VALUES (lower(:lower_1))",
+ )
+
@testing.combinations(
("plain", "sometable", "sometable"),
("matched_square_brackets", "colo[u]r", "[colo[u]]r]"),