From: Mike Bayer Date: Tue, 14 Feb 2012 17:04:04 +0000 (-0500) Subject: - [bug] Altered _params_from_query() function X-Git-Tag: rel_0_7_6~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c24a1615300a3d90f6e2dbafadcf2c1694ed44fc;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - [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. --- diff --git a/CHANGES b/CHANGES index 438e8520b6..c1869f5556 100644 --- 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 diff --git a/examples/beaker_caching/caching_query.py b/examples/beaker_caching/caching_query.py index bbf0f29545..a6a1261113 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