summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2011-02-13 22:30:00 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2011-02-13 22:30:00 -0500
commit6458094024107e81eb7c9be140a1a385d26071a6 (patch)
tree61f987523ff70daf6ef698346558d65473dc2385 /examples
parent306aaf3b16ba636aaa069c7b97d11744524e8530 (diff)
downloadsqlalchemy-6458094024107e81eb7c9be140a1a385d26071a6.tar.gz
- Beaker example now takes into account 'limit'
and 'offset', bind params within embedded FROM clauses (like when you use union() or from_self()) when generating a cache key.
Diffstat (limited to 'examples')
-rw-r--r--examples/beaker_caching/caching_query.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/beaker_caching/caching_query.py b/examples/beaker_caching/caching_query.py
index 4af812500..4240e7e13 100644
--- a/examples/beaker_caching/caching_query.py
+++ b/examples/beaker_caching/caching_query.py
@@ -121,8 +121,9 @@ def _get_cache_parameters(query):
if cache_key is None:
# cache key - the value arguments from this query's parameters.
- args = _params_from_query(query)
- cache_key = " ".join([str(x) for x in args])
+ args = [str(x) for x in _params_from_query(query)]
+ args.extend([str(query._limit), str(query._offset)])
+ cache_key = " ".join(args)
assert cache_key is not None, "Cache key was None !"
@@ -269,4 +270,6 @@ def _params_from_query(query):
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})
return v