diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-11-10 21:10:51 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-11-10 21:10:51 -0500 |
commit | 8318a98a60dabf0919f4998e4df32db804ffd3bb (patch) | |
tree | 760c2bb00f50b5d868b8d228fc9fac04767bceb4 /lib/sqlalchemy/sql/compiler.py | |
parent | ab1e6fb08f7cfbba94f0115368f08f6130bf0018 (diff) | |
download | sqlalchemy-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 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 27ee4afc6..87a9f859b 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2407,6 +2407,9 @@ class StrSQLCompiler(SQLCompiler): 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, {}) |