diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-02-22 23:17:15 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-02-22 23:17:15 +0000 |
commit | bb6ec17708e56170bcccf7e32703d0ba37b160d2 (patch) | |
tree | 1da7768491154707db045c235f1ba6f2170a02e7 /lib/sqlalchemy/sql/compiler.py | |
parent | e203b4dd4e2ce24e18fbeb9db515b2bdbbb56bc5 (diff) | |
download | sqlalchemy-bb6ec17708e56170bcccf7e32703d0ba37b160d2.tar.gz |
- the value of a bindparam() can be a callable, in which
case it's evaluated at statement execution time to
get the value.
- expressions used in filter(), filter_by() and others,
when they make usage of a clause generated from a
relation using the identity of a child object
(e.g. filter(Parent.child==<somechild>)), evaluate
the actual primary key value of <somechild> at
execution time so that the autoflush step of the
Query can complete, thereby populating the PK value
of <somechild> in the case that <somechild> was
pending.
- cleanup of attributes.get_committed_value() to never return
the NO_VALUE value; evaluates to None
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 8d8cfa38f..c5ff974e5 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -213,10 +213,19 @@ class DefaultCompiler(engine.Compiled): pd[name] = params[paramname] break else: - pd[name] = bindparam.value + if callable(bindparam.value): + pd[name] = bindparam.value() + else: + pd[name] = bindparam.value return pd else: - return dict([(self.bind_names[bindparam], bindparam.value) for bindparam in self.bind_names]) + pd = {} + for bindparam in self.bind_names: + if callable(bindparam.value): + pd[self.bind_names[bindparam]] = bindparam.value() + else: + pd[self.bind_names[bindparam]] = bindparam.value + return pd params = property(construct_params) |