diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-16 18:46:53 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-09-16 18:46:53 -0400 |
commit | 24a7241b5ef63f8e82c007d89f5c179d9596bf10 (patch) | |
tree | 00238ad56de2b15ac11df8e333de1e98e5386cab /lib/sqlalchemy/sql/compiler.py | |
parent | 7eb34baf99179eec966ddd8b3607a6d8cfdfba21 (diff) | |
download | sqlalchemy-24a7241b5ef63f8e82c007d89f5c179d9596bf10.tar.gz |
- The :func:`.type_coerce` construct is now a fully fledged Core
expression element which is late-evaluated at compile time. Previously,
the function was only a conversion function which would handle different
expression inputs by returning either a :class:`.Label` of a column-oriented
expression or a copy of a given :class:`.BindParameter` object,
which in particular prevented the operation from being logically
maintained when an ORM-level expression transformation would convert
a column to a bound parameter (e.g. for lazy loading).
fixes #3531
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 52116a231..691195772 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -765,6 +765,9 @@ class SQLCompiler(Compiled): x += "END" return x + def visit_type_coerce(self, type_coerce, **kw): + return type_coerce.typed_expression._compiler_dispatch(self, **kw) + def visit_cast(self, cast, **kwargs): return "CAST(%s AS %s)" % \ (cast.clause._compiler_dispatch(self, **kwargs), |