summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/sqlalchemy/sql/compiler.py2
-rw-r--r--lib/sqlalchemy/sql/crud.py7
-rw-r--r--test/sql/test_compiler.py16
3 files changed, 21 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 2431e53cc..993956ef0 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -2045,7 +2045,7 @@ class SQLCompiler(Compiled):
text += " " + extra_from_text
if update_stmt._whereclause is not None:
- t = self.process(update_stmt._whereclause)
+ t = self.process(update_stmt._whereclause, **kw)
if t:
text += " WHERE " + t
diff --git a/lib/sqlalchemy/sql/crud.py b/lib/sqlalchemy/sql/crud.py
index b66778578..a01b72e61 100644
--- a/lib/sqlalchemy/sql/crud.py
+++ b/lib/sqlalchemy/sql/crud.py
@@ -117,14 +117,14 @@ def _get_crud_params(compiler, stmt, **kw):
def _create_bind_param(
compiler, col, value, process=True,
- required=False, name=None):
+ required=False, name=None, **kw):
if name is None:
name = col.key
bindparam = elements.BindParameter(
name, value, type_=col.type, required=required)
bindparam._is_crud = True
if process:
- bindparam = bindparam._compiler_dispatch(compiler)
+ bindparam = bindparam._compiler_dispatch(compiler, **kw)
return bindparam
@@ -280,7 +280,8 @@ def _append_param_parameter(
compiler, c, value, required=value is REQUIRED,
name=_col_bind_name(c)
if not stmt._has_multi_parameters
- else "%s_0" % _col_bind_name(c)
+ else "%s_0" % _col_bind_name(c),
+ **kw
)
else:
if isinstance(value, elements.BindParameter) and \
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 85a9f77bc..00195c6bf 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -255,6 +255,22 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
literal_binds=True
)
+ def test_insert_literal_binds(self):
+ stmt = table1.insert().values(myid=3, name='jack')
+
+ self.assert_compile(
+ stmt,
+ "INSERT INTO mytable (myid, name) VALUES (3, 'jack')",
+ literal_binds=True)
+
+ def test_update_literal_binds(self):
+ stmt = table1.update().values(name='jack').where(table1.c.name == 'jill')
+
+ self.assert_compile(
+ stmt,
+ "UPDATE mytable SET name='jack' WHERE mytable.name = 'jill'",
+ literal_binds=True)
+
def test_select_precol_compile_ordering(self):
s1 = select([column('x')]).select_from(text('a')).limit(5).as_scalar()
s2 = select([s1]).limit(10)