summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-11-10 21:10:51 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2018-11-10 21:10:51 -0500
commit8318a98a60dabf0919f4998e4df32db804ffd3bb (patch)
tree760c2bb00f50b5d868b8d228fc9fac04767bceb4 /test/sql/test_compiler.py
parentab1e6fb08f7cfbba94f0115368f08f6130bf0018 (diff)
downloadsqlalchemy-8318a98a60dabf0919f4998e4df32db804ffd3bb.tar.gz
Add Sequence to StrSQLCompiler
Added :class:`.Sequence` to the "string SQL" system that will render a meaningful string expression (``"<next sequence value: my_sequence>"``) when stringifying without a dialect a statement that includes a "sequence nextvalue" expression, rather than raising a compilation error. Fixes: #4144 Change-Id: Ia910f0e22008a7cde7597365954ede324101cf4d
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 993008c07..22b46cc46 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -2898,6 +2898,18 @@ class StringifySpecialTest(fixtures.TestBase):
"SELECT anon_1.myid FROM anon_1"
)
+ def test_next_sequence_value(self):
+ # using descriptive text that is intentionally not compatible
+ # with any particular backend, since all backends have different
+ # syntax
+
+ seq = Sequence("my_sequence")
+
+ eq_ignore_whitespace(
+ str(seq.next_value()),
+ "<next sequence value: my_sequence>"
+ )
+
def test_returning(self):
stmt = table1.insert().returning(table1.c.myid)