]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [bug] Altered _params_from_query() function
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Feb 2012 17:04:04 +0000 (12:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Feb 2012 17:04:04 +0000 (12:04 -0500)
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.

CHANGES
examples/beaker_caching/caching_query.py

diff --git a/CHANGES b/CHANGES
index 438e8520b674a8963f22b5660c1b48982f526a34..c1869f55564c9056c78bf59abc51c566d2a452b1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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
index bbf0f29545b58cc9cd41cb1a971321f0b65ee92a..a6a1261113a974d83f45ecc78c89e42c8c5e0fa1 100644 (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