summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-02-14 12:04:04 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-02-14 12:04:04 -0500
commitc24a1615300a3d90f6e2dbafadcf2c1694ed44fc (patch)
treeae6df871582dd505504434efac40081ee2220985 /examples
parentae5625f3d9bfb82efe811fe7314d2b1499520da7 (diff)
downloadsqlalchemy-c24a1615300a3d90f6e2dbafadcf2c1694ed44fc.tar.gz
- [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.
Diffstat (limited to 'examples')
-rw-r--r--examples/beaker_caching/caching_query.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/beaker_caching/caching_query.py b/examples/beaker_caching/caching_query.py
index bbf0f2954..a6a126111 100644
--- a/examples/beaker_caching/caching_query.py
+++ b/examples/beaker_caching/caching_query.py
@@ -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