diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-20 15:09:51 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-04-20 15:28:45 -0400 |
commit | 3a0a6e1db43a4aefd3570f2956ae2567e3062a77 (patch) | |
tree | fddf3de01a9e37cb6ff4661ff78ceebeeb117ef3 /lib/sqlalchemy/sql/compiler.py | |
parent | 141846612700b5355173e7883f048ffa21ad1f75 (diff) | |
download | sqlalchemy-3a0a6e1db43a4aefd3570f2956ae2567e3062a77.tar.gz |
Propagate compiler kw for visit_values to parameters
Fixed issue in SQL compiler where the bound parameters set up for a
:class:`.Values` construct wouldn't be positionally tracked correctly if
inside of a :class:`_sql.CTE`, affecting database drivers that support
VALUES + ctes and use positional parameters such as SQL Server in
particular as well as asyncpg. The fix also repairs support for
compiler flags such as ``literal_binds``.
Fixes: #6327
Change-Id: I2d549228691d0bfc10dadd0955b1549d7584db51
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 84df0837c..4c591a87f 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -2724,13 +2724,13 @@ class SQLCompiler(Compiled): return text def visit_values(self, element, asfrom=False, from_linter=None, **kw): - + kw.setdefault("literal_binds", element.literal_binds) v = "VALUES %s" % ", ".join( self.process( elements.Tuple( types=element._column_types, *elem ).self_group(), - literal_binds=element.literal_binds, + **kw ) for chunk in element._data for elem in chunk |