From 16cd07c4f896b03d0e73fc28b5279421dab53489 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 5 Feb 2014 12:03:46 -0500 Subject: - Fixed bug where so-called "literal render" of :func:`.bindparam` constructs would fail if the bind were constructed with a callable, rather than a direct value. This prevented ORM expressions from being rendered with the "literal_binds" compiler flag. --- lib/sqlalchemy/sql/compiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/compiler.py') diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 673e5f89b..d4b080720 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -969,7 +969,7 @@ class SQLCompiler(Compiled): if literal_binds or \ (within_columns_clause and \ self.ansi_bind_rules): - if bindparam.value is None: + if bindparam.value is None and bindparam.callable is None: raise exc.CompileError("Bind parameter '%s' without a " "renderable value not allowed here." % bindparam.key) @@ -1005,7 +1005,7 @@ class SQLCompiler(Compiled): return self.bindparam_string(name, **kwargs) def render_literal_bindparam(self, bindparam, **kw): - value = bindparam.value + value = bindparam.effective_value return self.render_literal_value(value, bindparam.type) def render_literal_value(self, value, type_): -- cgit v1.2.1