- [bug] Altered _params_from_query() function

in Beaker example to pull bindparams from the
fully compiled statement, as a quick means
to get everything including subqueries in the
columns clause, etc.
This commit is contained in:
Mike Bayer 2012-02-14 12:04:04 -05:00
parent ae5625f3d9
commit c24a161530
2 changed files with 15 additions and 4 deletions

View File

@ -128,6 +128,13 @@ CHANGES
- [bug] Added missing compilation support for
LONG [ticket:2401]
- examples
- [bug] Altered _params_from_query() function
in Beaker example to pull bindparams from the
fully compiled statement, as a quick means
to get everything including subqueries in the
columns clause, etc.
0.7.5 (January 28, 2012)
=====
- orm

View File

@ -268,8 +268,12 @@ def _params_from_query(query):
value = bind.value
v.append(value)
if query._criterion is not None:
visitors.traverse(query._criterion, {}, {'bindparam':visit_bindparam})
for f in query._from_obj:
visitors.traverse(f, {}, {'bindparam':visit_bindparam})
# TODO: this pulls the binds from the final compiled statement.
# ideally, this would be a little more performant if it pulled
# from query._criterion and others directly, however this would
# need to be implemented not to miss anything, including
# subqueries in the columns clause. See
# http://stackoverflow.com/questions/9265900/sqlalchemy-how-to-traverse-bindparam-values-in-a-subquery/
visitors.traverse(query.statement, {}, {'bindparam':visit_bindparam})
return v