summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.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/test_sqlite.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/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index 286c6bcf8..643a56c1b 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -51,6 +51,7 @@ from sqlalchemy.testing import combinations
from sqlalchemy.testing import config
from sqlalchemy.testing import engines
from sqlalchemy.testing import eq_
+from sqlalchemy.testing import eq_ignore_whitespace
from sqlalchemy.testing import expect_raises
from sqlalchemy.testing import expect_warnings
from sqlalchemy.testing import fixtures
@@ -972,6 +973,21 @@ class SQLTest(fixtures.TestBase, AssertsCompiledSQL):
"INTEGER) AS anon_1 FROM t" % subst,
)
+ 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=sqlite.SQLiteDialect())),
+ "INSERT INTO t (description) VALUES (lower(?)) "
+ "RETURNING myid, name, description",
+ )
+
def test_true_false(self):
self.assert_compile(sql.false(), "0")
self.assert_compile(sql.true(), "1")