--- /dev/null
+.. change::
+ :tags: feature, sql
+ :tickets: 4144
+
+ 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.
+
+
def visit_json_path_getitem_op_binary(self, binary, operator, **kw):
return self.visit_getitem_binary(binary, operator, **kw)
+ def visit_sequence(self, seq, **kw):
+ return "<next sequence value: %s>" % self.preparer.format_sequence(seq)
+
def returning_clause(self, stmt, returning_cols):
columns = [
self._label_select_column(None, c, True, False, {})
"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)