- marked as critical
literal binds for text()
Issue #2882
resolved
not sure if this is for 0.8 or not
from sqlalchemy import *
from sqlalchemy.dialects import sqlite
t = text("select * where x = :bind").bindparams(bind='x')
print t.compile(dialect=sqlite.dialect(), compile_kwargs={"literal_binds": True})
should print:
select * where x = 'x'
#!diff
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 0c25208..3c8d713 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -585,13 +585,13 @@ class SQLCompiler(Compiled):
def post_process_text(self, text):
return text
- def visit_textclause(self, textclause, **kwargs):
+ def visit_textclause(self, textclause, **kw):
def do_bindparam(m):
name = m.group(1)
if name in textclause._bindparams:
- return self.process(textclause._bindparams[name](name))
+ return self.process(textclause._bindparams[name](name), **kw)
else:
- return self.bindparam_string(name, **kwargs)
+ return self.bindparam_string(name, **kw)
# un-escape any \:params
return BIND_PARAMS_ESC.sub(lambda m: m.group(1),
Comments (3)
-
reporter -
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.9.0 (automated comment)
- Log in to comment
for 0.9 along with
#2651