Cancel any query caching that will occur on this BakedQuery object. The BakedQuery can continue to be used normally, however additional creational functions will not be cached; they will be called on every invocation. This is to support the case where a particular s
(self, full=False)
| 131 | return self.for_session(session) |
| 132 | |
| 133 | def spoil(self, full=False): |
| 134 | """Cancel any query caching that will occur on this BakedQuery object. |
| 135 | |
| 136 | The BakedQuery can continue to be used normally, however additional |
| 137 | creational functions will not be cached; they will be called |
| 138 | on every invocation. |
| 139 | |
| 140 | This is to support the case where a particular step in constructing |
| 141 | a baked query disqualifies the query from being cacheable, such |
| 142 | as a variant that relies upon some uncacheable value. |
| 143 | |
| 144 | :param full: if False, only functions added to this |
| 145 | :class:`.BakedQuery` object subsequent to the spoil step will be |
| 146 | non-cached; the state of the :class:`.BakedQuery` up until |
| 147 | this point will be pulled from the cache. If True, then the |
| 148 | entire :class:`_query.Query` object is built from scratch each |
| 149 | time, with all creational functions being called on each |
| 150 | invocation. |
| 151 | |
| 152 | """ |
| 153 | if not full and not self._spoiled: |
| 154 | _spoil_point = self._clone() |
| 155 | _spoil_point._cache_key += ("_query_only",) |
| 156 | self.steps = [_spoil_point._retrieve_baked_query] |
| 157 | self._spoiled = True |
| 158 | return self |
| 159 | |
| 160 | def _effective_key(self, session): |
| 161 | """Return the key that actually goes into the cache dictionary for |